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
Oscar Rambla
2004-09-09
On Thursday 26 August 2004 13:18, Neil Schemenauer wrote:
> I haven't converted the _c_htmltext module to use unicode strings
> but I think pretty much everything else works:
>
Hi,

I've done a simple test:

        uni_val= u"\u00d2scar"  # Ok
        self.add_widget("string", "name", title=uni_val, value=uni_val,
                        size=20, required=1)  # Ok

        uni_val  # Ok
        '

Uni es %s

' % uni_val # XXX log: File "/usr/local/lib/python2.3/site-packages/quixote/demo/forms.ptl", line 97, in action '

Uni es %s

' % uni_val File "/usr/local/lib/python2.3/site-packages/quixote/_py_htmltext.py", line 85, in __mod__ return htmltext(self.s % args) UnicodeEncodeError: 'ascii' codec can't encode character u'\xd2' in position 0: ordinal not in range(128) The same while tryes to show traceback: File "/usr/local/lib/python2.3/site-packages/quixote/publish.py", line 534, in publish request.response.set_body(output) File "/usr/local/lib/python2.3/site-packages/quixote/http_response.py", line 219, in set_body self.body = unicode(body).encode(self.charset) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1142: ordinal not in range(128) Doing something wrong? Also, I wonder where to call set_charset. At first, thought on start_request, but it's not enough for exceptions. Wouldn't a config var help publisher do it itself? Ex: if request.response.charset is None: request.response.set_charset( self.config.charset ) Application users could still select a diferent encoding per session. ( If exceptions are showed, then, config ought to be UTF-8) Thanks, -Oscar Rambla
reply