141 points · by bmease · 13y ago · 34 comments
http://hg.python.org/cpython/file/tip/Objects/unicodeobject....
CPython supports several internal representations from one to four bytes per character to optimize for space and performance. There's also a nifty sort of Bloom filter for quick discrimination of strings that might contain characters of interest.
I hope I never forget about changing them back and end up having to debug two different machines with the same MAC (which has actually happened to me in the wild, with two machines coming out of factory with the same MAC, talk about bad luck and shitty quality control).
The magic number that identifies a java .class file is 0xCAFEBABE.
Hmm, may I ask what makes utf8 won't produce U+DEADBEEF? Or something remotely like that?
Edit:
'\xfb\x9b\xbb\xaf'.decode('utf8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xfb in position 0: invalid start byte
http://en.wikipedia.org/wiki/G%C3%B6del's_incompleteness_the... http://www.amazon.com/G%C3%B6del-Escher-Bach-Eternal-Golden/...
Well, the comments state that to make this happen he had to "[exploit] a bug in the UTF-7 decoder". So, not legal assertions.