3 ms·
In Python 2.x are encoded in UCS-2, not UTF-16, at least by default (I'm not sure about Python 3.x, I assume it's the same though). If you want to support every
by eklitzke 16y ago
In Python 2.x are encoded in UCS-2, not UTF-16, at least by default (I'm not sure about Python 3.x, I assume it's the same though). If you want to support every single possible Unicode codepoint, you can tell Python to do so at compile time (via ./configure flag).
In practice the characters that aren't in UCS-2 tend to be characters that don't exist in modern languages, e.g. the characterset for Linear B, Domino tiles, and Cuneiform, so they're not supported since they're not of practical use to most people. There's a fairly good list at http://en.wikipedia.org/wiki/Plane_(Unicode) http://en.wikipedia.org/wiki/Plane_(Unicode) . In this list, Python by default doesn't support things not in the BMP.
- Locke1689 16y agoNo, the Python internals support surrogates so you can support characters outside the BMP. This makes it (basically) UTF-16.
- sedachv 16y agoThings outside of the BMP aren't just dead languages anymore. You have to be able to support characters outside the BMP if you want to sell your software in China: http://en.wikipedia.org/wiki/GB_18030 http://en.wikipedia.org/wiki/GB_18030