durusmail: quixote-users: First cut at Unicode support
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
First cut at Unicode support
Skip Montanaro
2003-11-15
Okay, here's a first quick hack for Unicode support.  There are a few
caveats.

    * I didn't consider very hard how to specify the encoding.  You can set
      it in the config file or in a function call
      request.response.set_encoding().  I have not yet tried the latter.

    * I ignored the faster C version of TemplateIO and friends altogether
      and simply raise ImportError when importing it to force the Python
      version.

    * I made some token changes to form/form.py but they haven't been
      tested.  In fact, the only two tests I've performed so far are

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

      and

        def freddie (request):
            return u'Fr\xe9ddie Kr\xfcger'

      Pretty thorough, huh?  I'll try some other stuff over the
      weekend (like overriding encoding within a function and mixing strings
      and unicode objects in the same function).

    * There's a bad hack in htmltext, the asstring() method.  Maybe I should
      have named it ass_string() instead.  Someone smarter than me can
      figure out how to avoid messing up an otherwise nice class.
      Fortunately, it's only called once.

    * I reorganized the code in Publisher.publish() a bit to keep from
      duplicating the code which chooses between string, unicode and
      htmltext objects.  I think it's okay, but probably needs a glance.  I
      also renamed the 'object' variable to 'obj'.

There's a context diff against 0.6.1 at:

    http://manatee.mojam.com/~skip/python/quixote.diff

Skip

reply