Encoding Text

Paul Jefferson pauljefferson at gmail.com
Sat May 3 19:02:29 EDT 2008


Hi,
I'm learning this and I'm making a program which takes RSS feeds and
processes them and then outputs them to a HTML file.
The problem I have is that some of the RSS feeds contain chachters which I
think are outside of the ascii range as when I attempt to write the file
containing themI get the follwoign error:
File "C:\Users\Paul\Desktop\python\Feed reader\test.py", line 201, in
<module>
    runner(1,"save.ahc")
  File "C:\Users\Paul\Desktop\python\Feed reader\test.py", line 185, in
runner
    h.write(html[countera])
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in
position 1147: ordinal not in range(128)
For the life of me I can't figure out what I should do to stop this - I
tried to change the html by doing a html[countera] = unicode(html[countera])
but it didn't seem to chaneg anything.
Any help would be greatly appreciated,
Thanks
Paul

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080504/37efbbe4/attachment.html>


More information about the Python-list mailing list