[mod_python] UnicodeDecodeError with util.FieldStorage(req).Field.value

Anastasios Hatzis ah at hatzis.de
Mon Jun 25 09:47:55 EDT 2007


On Saturday 23 June 2007, Martin wrote:
> Have seen that Graham has responded now, but a few things need clarifying.
>
> On 20/06/07, Anastasios Hatzis <ah at hatzis.de> wrote:

[...]

Graham, Martin

Thank you for your help. Charsets and encoding is definitely the most 
difficult thing for me in programming. In case of Python I always expect 
encode() to the opposite of what it is actually doing and vice versa. :/

However, the following worked for me:

        email_body = u'\r\n'
        for param in store.list:
            email_body += unicode(param.name, 'utf-8') + ': ' + \                 
			      unicode(param.value, 'utf-8') + '\r\n'

Again, thank you.

Anastasios
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: not available
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070625/64c12890/attachment.bin


More information about the Mod_python mailing list