[wxPython-users] Failed to display HTML document in ISO-8859-1
encoding
Gabriele
gabriele.biarese at gmail.com
Mon Sep 4 08:38:30 PDT 2006
If html is a unicode iso-8859-1 string, you have 2 possibilities:
1) set the system default encoding to iso-8859-1
2) decode your string to ascii: html.decode('iso-8859-1')
I hope that will help you.
Gabriele.
2006/9/4, Milos Negovanovic <milos.negovanovic at googlemail.com>:
> On Mon, Sep 04, 2006 at 01:36:09PM +0800, Anthony Wiese wrote:
> > It looks like you're trying to send non ISO-8859-1 characters to your HTML
> > control, which is trying to convert it. Either you can strip out any
> > offending characters, or else you probably need to change your html header.
> >
> > If you make sure that when you set the contents of your HTML window to
> > include an html header which contains:
> >
> > <head>
> > ....
> > <meta http-equiv="Content-Type" content="text/html; charset=XXXXXXXXX">
> > <title>...</title>
> > </head>
> >
> > with your charset modified to a suitable encoding, it should work. At least,
> > that's how I got it to work on my system.
>
> well, i made this little method:
>
> def setHTMLHelp(self, html):
> encoding = sys.getdefaultencoding()
> html = '%s%s%s%s%s' % (
> '<html><head><meta http-equiv="Content-Type" content="text/html; charset=',
> encoding,
> '" /></head><body>',
> html,
> '</body></html>')
> print html
> self.htmlDisplay.SetPage(html)
>
> and it still doesn't work. Hmm no idea what might be wrong. Default
> system encoding seems to be ascii, if that's of any help.
>
> Regards
> Milos
More information about the wxpython-users
mailing list