Unicode and Win2k

Toby Dickenson mbel44 at dial.pipex.net
Tue Oct 3 06:35:27 EDT 2000


"Aleksei Guzev" <aleksei.guzev at bigfoot.com> wrote:

>Russian is my mather's tongue. I've experienced a lot of problems with
>cyrillic using python 1.6 on Windows 2000 Professional. The main issue is a
>range check error while built-in function <str> tries to fit my russian
>strings into 7-bit ASCII.

>Maybe I should take care of some conversions? 

Yes

>But it would be annoying to convert the strings back and forth.

If you keep all your string data internally as unicode objects then
you only need to encode it once, on output.

The time this doesnt work is for legacy code (often debugging, logging
or diagnostics cods) that assumes all objects can be safely converted
to a 8bit string with str. This assumption was never completely true -
for these tasks I suggest repr() is a better choice than str().


Toby Dickenson
tdickenson at geminidataloggers.com



More information about the Python-list mailing list