Unicode problems, yet again

Ivan Voras ivoras at _-_fer.hr
Sun Apr 24 05:26:20 EDT 2005


Jp Calderone wrote:

>  You don't have a string fetched from a database, in iso-8859-2, alas.  
> That is the root of the problem you're having.  What you have is a 
> unicode string.

Yes, you're right :) I actually did have iso-8859-2 data, but, as I 
found out late last night, the data got converted to unicode along the way.

Thanks to all who replied so quickly :)

>> (Does anyone else feel that python's unicode handling is, well... 
>> suboptimal at least?)
> 
>  Hmm.  Not really.  The only problem I've found with it is misguided 
> attempt to "do the right thing" by implicitly encoding unicode strings, 
> and this isn't so much of a problem once you figure things out, because 
> you can always do things explicitly and avoid invoking the implicit 
> behavior.

I'm learning that, the hard way :)

One thing that I always wanted to do (but probably can't be done?) is to 
set the default/implicit encoding to the one I'm using... I often have 
to deal with 8-bit encodings and rarely with unicode. Can it be done 
per-program?




More information about the Python-list mailing list