469,929 Members | 1,819 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,929 developers. It's quick & easy.

Decode html, or is it unicode, how?

Hi All,
I've done a bunch of searching in google and in python's help, but,
I haven't found any function to decode a string like:
Refresh! (ihenvyr)
In to plain english.
I'd also looked for the urldecode function in urllib, but that had been
deprecated.
If anyone here can give me a hand, I'd aprishiate it; it's probably very
simple, but...

Thx,

----------
Brandon McGinty
Feel free to contact me for technical support, or just to chat; I always
have time to talk and help, and an open ear.
Email:Br*************@gmail.com
Skype:brandon.mcginty
Msn:br*************@hotmail.com
Aim:brandonmcginty (Not currently available.)
Cell:(480)-202-5790 (Weekends and nights only, please.)
"Kindness is a language that the deaf can hear and the blind can see."
Mark Twain

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.1/313 - Release Date: 4/15/2006
Apr 17 '06 #1
1 1164
On 2006-04-17, <br*************@gmail.com> <br*************@gmail.com> wrote:
Hi All,
I've done a bunch of searching in google and in python's help, but,
I haven't found any function to decode a string like:
Refresh! (ihenvyr)
In to plain english.
[...]


I needed to do that the other day, and did it like this:

def decode(line):
pat = re.compile(r'&#(\d+);')
def sub(mo):
return unichr(int(mo.group(1)))
return pat.sub(sub, unicode(line))

there may well be a better way though.
Apr 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by David Pratt | last post: by
15 posts views Thread by glacier | last post: by
1 post views Thread by Eric S. Johansson | last post: by
1 post views Thread by anonymous | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.