convert utf-8 to latin-1?

Jarek Zgoda jzgoda at gazeta.usun.pl
Fri Feb 6 15:07:45 EST 2004


Martin v. Löwis <martin at v.loewis.de> pisze:

>> Currently I convert the returned, of what I'm pretty sure its a utf-8 string
>> object, to a normal string using the str() function. 
> 
> Try converting the object to a Unicode object. I don't know what you
> mean by "utf-8 string object"; Python has no such thing (but PyQt may).

Any "string value" is returned by PyQt as QString, which is "compatible
with UTF-8 strings", as Qt documentation states. In programming practice
this means that you can use str() only when you expect receiving pure
ASCII text. In any other case you should use unicode() to convert
QString to unicode object. This fairly means taht you should *always*
use unicode(). 

Unless you write software that is allowed to run only in US.

-- 
Jarek Zgoda
Unregistered Linux User #-1
http://www.zgoda.biz/ JID:zgoda-a-chrome.pl http://zgoda.jogger.pl/



More information about the Python-list mailing list