ASCII encoding error: ordinal not in range(128)

Ben Hutchings ben.hutchings at roundpoint.com
Tue Mar 20 17:43:40 EST 2001


"Jose Isaias Cabrera" <jicman at cinops.xerox.com> writes:

> Greetings all!
> 
> I have a python program that interfaces with Microsoft Outlook.  I
> am running into a problem when I have attachments and subject titles
> with different characters that are not your normal everyday
> character.
<snip>
> UnicodeError: ASCII encoding error: ordinal not in range(128)
> 
> I've search on python sites for this, and though there is something about
> Unicode, there is no python example code to use.
>
> Does anyone have any idea how to fix this?

Not much, because you didn't post any code.  But you should probably
be looking at the codecs.EncodedFile class, which wraps a non-ASCII
text file (or file-like object) and translates whatever encoding the
file uses (which you must discover and specify) to and from Unicode.

-- 
Any opinions expressed are my own and not necessarily those of Roundpoint.



More information about the Python-list mailing list