problem with unicode
Matt Nordhoff
mnordhoff at mattnordhoff.com
Fri Apr 25 09:08:49 EDT 2008
andreas.profous at googlemail.com wrote:
> Hi everybody,
>
> I'm using the win32 console and have the following short program
> excerpt
>
> # media is a binary string (mysql escaped zipped file)
>
>>> print media
> xワユロ[ヨ
...
> (works)
>
>>> print unicode(media)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position
> 1: ordinal not in range(128)
> (ok i guess print assumes you want to print to ascii)
<snip more code snippets>
> I don't know what to do. I just want to concatenate two string where
> apparently one is a binary string, the other one is a unicode string
> and I always seem to get this error.
>
> Any help is appreciated :)
You should read the Python Unicode documentation, such as:
<http://boodebr.org/main/python/all-about-python-and-unicode>
<http://docs.python.org/dev/howto/unicode.html>
and maybe a non-Python-specific article:
<http://www.joelonsoftware.com/articles/Unicode.html>
--
More information about the Python-list
mailing list