Svennglenn wrote:
> I'm having problems replacing text in a
> unicode string.
> Here's the code:
>
> # -*- coding: cp1252 -*-
>
> titel = unicode("ä", "iso-8859-1")
> print titel
> print type(titel)
>
> titel.replace("ä", "a")
>
> When i run this program I get this error:
>
>     titel.replace("ä", "a")
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position
0:
> ordinal not in range(128)
>
> How can i replace text in the Unicode string?

titel = titel.replace(u"ä", "a")

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to