[Python-3000] string C API

"Martin v. Löwis" martin at v.loewis.de
Wed Sep 13 17:15:47 CEST 2006

Jim Jewett schrieb:
>> For example, PyString_From{String[AndSize]|Format} would either:
>> - have to grow an encoding argument
>> - assume a default encoding (either ASCII or UTF-8)
>> - change its signature to operate on Py_UNICODE* (although
>>   we don't have literals for these) or
>> - be removed
> Should encoding be an attribute of the string?

No. A Python string is a sequence of Unicode characters.
Even if it was created by converting from some other encoding,
that original encoding gets lost when doing the conversion
(just like integers don't remember which base they were originally
represented in).


More information about the Python-3000 mailing list