ConfigParser and Unicode

Thomas Heller theller at python.net
Thu Mar 18 14:34:28 EST 2004


thehaas at binary.net writes:

> "Martin v. Löwis" <martin at v.loewis.de> wrote:
>> thehaas at binary.net wrote:
>> > Obviously, 'Grüß'!='Gr\xfc\xdf' .  
>
>> It is not at all obvious that they are different. In fact, they
>> are the same, assuming the second string is encoding in Latin-1.
>
>> > Any ideas on how I can get the correct value?
>
>> Pray tell: what is the correct value?
>
> The correct value is 'Grüß', or at least have it equal to that.
>
> Maybe I should back up -- I'm interfacing into a Windows API.  In that
> API, I see 'Grüß' as:
>   >>> plist[-1].Reference
>   u'Gr\xfc\xdf'
>
> My value in goodProcList is:
>   >>> goodProcRef[18]
>   'Gr\xfc\xdf'

Try this:

>>> "Gr\xfc\xdf".decode("latin-1")
u'Gr\xfc\xdf'
>>>

Thomas





More information about the Python-list mailing list