Unicode string formating
Hi,
I need to do a lot of string formating, and I have strings and/or
unicode strings and when I do the following:
"%s %s" % (u'Salut', 'H\xe4llo'), I get an exception :
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position
1: ordinal not in range(128)
How can I insure I don't get an exception?
Thanks,
Nicolas
.
Relevant Pages
- Re: UnicodeEncodeError: ascii codec cant encode character uxb7 in position 13: ordinal not in range(
... and it doesn't make sense to decode a Unicode string. ... decode encoded things which are byte strings. ... read and write Unicode strings, ... Sent from the Python - python-list mailing list archive at Nabble.com. ... (comp.lang.python) - Re: UnicodeEncodeError: ascii codec cant encode character uxb7 in position 13: ordinal not in range(
... and it doesn't make sense to decode a Unicode string. ... decode encoded things which are byte strings. ... read and write Unicode strings, ... decoding of its own. ... (comp.lang.python) - Re: UnicodeEncodeError: ascii codec cant encode character uxb7 in position 13: ordinal not in range(
... you were write: unintentionally I removed strip(). ... UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-2: invalid ... decode encoded things which are byte strings. ... read and write Unicode strings, ... (comp.lang.python) - Re: When will delphi have a unicode index operator ? ;)
... > strings through the Char, PChar, AnsiChar, PAnsiChar, and AnsiString types. ... (Names of multibyte ... Multibyte character support is operating-system ... Multibyte strings are not the same as Unicode strings, ... (alt.comp.lang.borland-delphi) - Re: Unicode/UTF-8 decoding
... I don't really know how this work, but IE or Firefox browser can decode easily. ... This text looks as it has been decoded with a different encoding than was used to encode it. ... If you want to store unicode strings in the MySQL database, it has to be set up to use unicode as character set. ... While this gives the correct result for some strings, some byte codes used in UTF-8 doesn't represent a single character by themselves, so if you contine to store mis-decoded strings as unicode, you will sooner or later experience corrupted strings. ... (microsoft.public.dotnet.languages.vb) |
|