durusmail: quixote-users: Unicode support for Quixote 2
Unicode support for Quixote 2
2004-09-03
2004-09-03
2004-09-03
2004-09-03
Quixote / mod_python - test workflow?
2004-09-04
Re: R: [Quixote-users] Quixote / mod_python - test workflow?
single word attributes in html.htmltag()
2004-09-05
Re: single word attributes in html.htmltag()
2004-09-06
2004-09-04
2004-09-08
Python Best of Breed web app snippets / small webapps
2004-09-08
2004-09-10
2004-09-09
2004-09-09
2004-09-09
2004-09-09
Unicode support for Quixote 2
Neil Schemenauer
2004-09-03
On Fri, Sep 03, 2004 at 01:26:38PM +0200, Marcin Wojdyr wrote:
> If there are non-ascii chars in PTL it doesn't work:
[...]
>   File "/usr/lib/python2.3/site-packages/quixote/http_response.py", line
> 210, in set_body     self.body = unicode(body).encode(self.charset)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 954:
> ordinal not in range(128)

You need to use unicode strings if you want to use non-ascii
characters.

> I changed
> self.body = unicode(body).encode(self.charset)
> to:
> self.body = str(body).decode("UTF-8").encode(self.charset)
> and it works as expected.
> I have self.charset=="ISO-8859-2".

That is almost certainly not what you want.

  Neil

reply