unicode codecs

Christopher Koppler klapotec at chello.at
Mon Feb 9 16:43:05 EST 2004


On Mon, 09 Feb 2004 21:59:36 +0100, Ivan Voras
<ivoras at __geri.cc.fer.hr> wrote:

>When concatenating strings (actually, a constant and a string...) i get 
>the following error:
>
>UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc in position 1: 
>ordinal not in range(128)
>
>Now I don't think either string is unicode, but I'm working with 
>win32api so it might be... :) The point is: I know all values will fit 
>in a particular code page (iso-8859-2), so how do I change the 'ascii' 
>codec in the above error into something that will work?

To get a real solution, you should also post the offending code, but
you might try to convert your values to unicode with the built-in
unicode() and the string method decode(). See the library reference
sections 2.1 and 2.2.6.

--
Christopher



More information about the Python-list mailing list