stefan_ml at behnel.de
Wed Mar 3 15:21:50 CET 2010
Giorgio, 03.03.2010 14:09:
>>> byte_string = unicode_string.encode('utf-8')
>> If you use unicode strings throughout your application, you will be happy
>> with the above. Note that this is an advice, not a condition.
> Mmm ok. So all strings in the app are unicode by default?
> Do you know if there is a function/method i can use to check encoding of a
Not sure what exactly you mean here. If you meant to say "guess the
encoding of a byte string", then there are a few ways to do that. But none
of them is guaranteed to work. Therefore my advice: use unicode everywhere
and decode byte strings on the way in, where you (hopefully) know their
encoding. If you don't know the encoding on the way in, reject the input.
More information about the Tutor