convert Unicode to lower/uppercase?
Peter Otten
__peter__ at web.de
Tue Sep 23 18:17:54 EDT 2003
Martin v. Löwis wrote:
> Peter Otten <__peter__ at web.de> writes:
>
>> Looking into stringobject.c (judging from a first impression,
>> unicodeobject.c has essentially the same algorithm, but with a few
>> indirections):
>
> You are mistaken. The implementation in unicodeobject.c is
> fundamentally different. The byte string implementation uses the C
> library, the Unicode implementation uses the Unicode character
> database. So the former cannot be changed, whereas the latter could,
> in theory, be extended to use additional data.
I followed the code to fixupper() which operates on a preallocated unicode
object and thus cannot cope with a string that expands while being
transformed. I didn't actually resolve the macros.
While we are at it, would it be viable to "abuse" the encoding/decoding
mechanism to do case conversions?
Peter
More information about the Python-list
mailing list