What encoding does u'...' syntax use?

"Martin v. Löwis" martin at v.loewis.de
Sat Feb 21 15:06:27 EST 2009

>>> My question is: what is that encoding?
>> The internal representation is either UTF-16, or UTF-32; which one is
>> a compile-time choice (i.e. when the Python interpreter is built).
> Wait, I thought it was UCS-2 or UCS-4?  Or am I misremembering the
> countless threads about the distinction between UTF and UCS?

You are not misremembering. I personally never found them conclusive,
and, with PEP 261, I think, calling the 2-byte version "UCS-2" is


More information about the Python-list mailing list