0

I use xinha as WYSIWYG editor for html-content. I sent html-articles via post-form to postgresql. So far so good, they seem ok. But when I receive and output from pg to an html page, I see double encoded, i.e. broken html code like this

<p><a href="http://google.com">google.com</a></p>   <p> </p>   <p>

Any idea on where to search for the issue? Thanks in advance

  • 1
    You should probably post some code to explain how you're getting the data in and out of postgres. – Colin Dunklau Jun 01 '12 at 23:44
  • How about a more specific breakdown of the process? You're not providing a whole lot to go on. – Joel Cornett Jun 01 '12 at 23:44
  • Seems similar to [this question](http://stackoverflow.com/questions/275174/how-do-i-perform-html-decoding-encoding-using-python-django) – Junuxx Jun 02 '12 at 02:21

1 Answers1

2
import HTMLParser
hp=HTMLParser.HTMLParser()
s="<p><a href="http://google.com">google.com</a></p>   <p> </p>   <p>"
print hp.unescape(s)

# u'<p><a href="http://google.com">google.com</a></p>   <p> </p>   <p>'
whi
  • 2,685
  • 6
  • 33
  • 40