durusmail: quixote-users: Next Unicode baby step - specifying encoding in PTL function
First cut at Unicode support
2003-11-15
2003-11-16
2003-11-17
Next Unicode baby step - specifying encoding in PTL function
2003-11-17
Next Unicode baby step - specifying encoding in PTL function
Next Unicode baby step - specifying encoding in PTL function
2003-11-17
Next Unicode baby step - specifying encoding in PTL function
Skip Montanaro
2003-11-17
I did a little more messing around with Unicode over the weekend.  I now have a
grand total of two PTL test cases:

    def freddie [html] (request):
        u'Fr\xe9ddie Kr\xfcger'

    def freddie2 [html] (request):
        u'Fr\xe9ddie Kr\xfcger'
        '
' u'Freddie Krueger' '
' request.response.set_encoding(str("iso-8859-1")) I got stuck on this because I couldn't figure out how to remove the str() call from the second function. When I do, Quixote complains: Traceback (most recent call last): File "/Users/skip/local/lib/python2.4/site-packages/quixote/publish.py", line 543, in publish output = self.process_request(request, env) File "/Users/skip/local/lib/python2.4/site-packages/quixote/publish.py", line 525, in process_request output = self.try_publish(request, env.get('PATH_INFO', '')) File "/Users/skip/local/lib/python2.4/site-packages/quixote/publish.py", line 482, in try_publish output = output.asstring(encoding) File "/Users/skip/local/lib/python2.4/site- packages/quixote/_py_htmltext.py", line 73, in asstring return self.s.encode(encoding) TypeError: encode() argument 1 must be string, not htmltext Do I have to call str() around any string I want to pass to a regular Python function, or did I muff something? I spun my wheels over the weekend under the assumption that I made a mistake, but will gladly move onto something else if someone says, "that's just the way Quixote works", or points out the bug in my Unicode diff at . Thx, Skip
reply