[Tutor] converting encoded symbols from rss feed?

Serdar Tumgoren zstumgoren at gmail.com
Thu Jun 18 00:00:02 CEST 2009


Hey everyone,
For the moment, I opted to use string replacement as my "solution."

So for the below string containing the HTML decimal represenation for en dash:

>>>x = "The event takes place June 17 – 19"
>>>x.replace('–', '-')
'The event takes place June 17 - 19'

It works in my case since this seems to be the only code that
Universal Feed Parser didn't properly translate, but of course not an
ideal solution. I assume this path will require me to build a
character reference dictionary as I encounter more character codes.

I also tried wrestling with character conversion:

>>>unichr(150)
u'\x96'

Not sure where to go from there...


More information about the Tutor mailing list