Problem with PARAGRAPH SEPARATOR

Matt Nordhoff mnordhoff at mattnordhoff.com
Thu Mar 20 22:09:09 CET 2008


Dominique.Holzwarth at ch.delarue.com wrote:
> Actually that's what I tried to do, for example:
> outputString = myString.encode('iso-8859-1','ignore')
> 
> However, I always get such messages (the character, that's causing problems varies, but its always higher than 127 ofc...)
> 
> 'ascii' codec can't decode byte 0xc3 in position 51: ordinal not in range(128) 
> 
> It doesn't matter what encoding I use (tried 'utf-8' 'utf-16' 'latin_1' and the iso one). The debugger is showing all the special characters (from french and german language) so I'm wondering why there's still the message about the 'ascii' codec...
> 
> Would that mean that the string "myString" is an ascii-string or what?

That's a *decode* error. If myString is a str object, it has to be
*decoded* before it can be *encoded* to ISO-8859-1 or whatever you want,
and it's defaulting to ASCII.

This page may help:
<http://boodebr.org/main/python/all-about-python-and-unicode>
-- 



More information about the Python-list mailing list