UnicodeError: ASCII encoding error: ordinal not in range(128)

Erik Max Francis max at alcyone.com
Sat Mar 1 19:38:51 EST 2003


Hasan Diwan wrote:

> I have a script to parse RSS feeds into HTML. Some of these RSS feeds
> contain characters outside the 7-bit ASCII range, and the page is set
> to
> display in utf8. My question is how to force the script below to
> output
> strings in UTF8 as opposed to ASCII:

Try

	S = U.encode('utf-8')

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ There's this perfect girl / Living inside the shell
\__/ Lamya
    Fauxident / http://www.alcyone.com/pyos/fauxident/
 A "faux" ident daemon in Python.




More information about the Python-list mailing list