Slide 28
Slide 28 text
s = 'abc'
us_ascii = s.encode('US-ASCII')
utf_16le = s.encode('UTF-16LE')
utf_32le = s.encode('UTF-32LE')
us_ascii.codepoints #=> [97, 98, 99]
utf_16le.codepoints #=> [97, 98, 99]
utf_32le.codepoints #=> [97, 98, 99]
us_ascii.bytes #=> [97, 98, 99]
utf_16le.bytes #=> [97, 0, 98, 0, 99, 0]
utf_32le.bytes #=> [97, 0, 0, 0, 98, 0, 0, 0, 99, 0, 0, 0]
ASCII Incompatibility