UTF-8 usage in Python 2.0

François Granger francois.granger at free.fr
Sat Oct 28 07:43:50 EDT 2000


Erno Kuusela <erno-news at erno.iki.fi> wrote:

> you can use the unicode() built-in function to convert old-fashioned
> 8-bit strings to unicode, using various character sets[...]
> 
> s = unicode('kääpiö', 'latin-1')
[...]
> you can convert it back to a 8-bit string with
> s.encode(encoding-name). for example
> 
> s.encode('utf-8') -> 'k\303\244\303\244pi\303\266'

It is really easier than what I thought.

Thanks

-- 
"C'est incroyable, il faut que je me fâche pour que vous répondiez
 à mes questions sur ce NG"
© - unknown -



More information about the Python-list mailing list