fredrik at pythonware.com
Tue Aug 19 00:15:52 CEST 2008
Joan Pallarès wrote:
> I tried to create unicode in this two ways:
> self.nombreLocal = unicode(nombreLocal)
> self.nombreLocal = unicode(nombreLocal, 'iso-8859-1')
the "unicode" constructor takes a string of bytes in some known
character encoding, and decodes them into a Unicode string. if you
leave out the encoding argument, it defaults to "ascii".
> But there is always one character that can't be encoded!! unicode
> doesn`t encode everything?
"unicode" is used to decode byte strings, not encode things.
from where do you get "nombreLocal", and what encoding does your source
use? can you provide an example of that one character that doesn't work?
More information about the Python-list