Andrew Veitch wrote:
Error Type: UnicodeDecodeError
Error Value: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)

If I change the input line to:

<input name="blah" type="text" tal:attributes="value python:chr(200)" />

Then this will work in HTML mode but will fail in XML mode.

This all sounds familiar. I remember having loads of fun with MailTemplates, which work predominantly in XML mode.

The rules I have from working with them are as follows:

    If content_type is set to text/html, then:

    - any unicodes should be encoded using the character set you
      intend to use for the final mail encoding

    - you are responsible for ensuring that any strings are encoded
      with the correct character set, which should be that used for
      the final mail encoding.

    If content_type is set to anything else:

    - all string-like data inserted into the Mail Template during
      rendering must be in the form of unicode objects.


So, in your case, make sure everything you insert with any tal is a unicode object.

hth,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to