[Tutor] rss feed reader, but having trouble with unicode

Michael Langford mlangford.cs03 at gtalumni.org
Thu Feb 28 16:07:00 CET 2008


feedparser.org also works really well for this sort of thing. Does a
lot of the unicode automagically for you.

       --michael

On Wed, Feb 27, 2008 at 8:58 AM, Tom <tavspamnofwd at googlemail.com> wrote:
> Finally got it working. I used your suggestion Rui, but I also had to
>  change the charset encoding that my database was using. Changed from
>  Latin-1 to UCS2.
>
>  I read http://www.joelonsoftware.com/articles/Unicode.html too.
>  Essential reading.
>
>  Thanks.
>
>
>
>  On 26/02/2008, rui <ruivaldo at gmail.com> wrote:
>  > Hello Tom,
>  >
>  >  Try doing this:
>  >
>  >  xml = unicode(xml, encoding, "ignore")
>  >  elem = ElementTree.fromstring(xml.encode("utf8"))
>  >
>  >
>  >  >  #do stuff with elem...
>  >  >
>  >  >  feed.xml = xml
>  >  >  feed.save()
>  >  >
>  >  >
>  >  >  Thanks for your time :-)
>  >
>  > >  _______________________________________________
>  >  >  Tutor maillist  -  Tutor at python.org
>  >  >  http://mail.python.org/mailman/listinfo/tutor
>  >  >
>  >
>  >
>  >
>  >  --
>  >  Rui
>  >  http://ruivaldo.wordpress.com
>  >
>  >  "Rubi? Aquela novela do SBT?"
>  >     ~ Carla Perez sobre Ruby
>  >
>  >  "Em Python, tudo é objeto, além de lindo e maravilhoso."
>  >     ~ Caetano Veloso sobre Python
>  >
>  _______________________________________________
>  Tutor maillist  -  Tutor at python.org
>  http://mail.python.org/mailman/listinfo/tutor
>



-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com


More information about the Tutor mailing list