[Moin-user] Re: Image formatters and UTF8

Jiba jibalamy at free.fr
Sat Feb 4 04:13:05 EST 2006


On Thu, 2 Feb 2006 23:43:32 +0100
Alexander Schremmer <2005a at usenet.alexanderweb.de> wrote:
> That sounds like a bug in your code.

Actually the formatter must return unicode object (because the cache system concatenate the returned string with other unicode strings). Thus i must convert my PNG image raw data into a unicode object. Then, when sending the result, the request encode it using config.charset (="utf-8"), and my PNG data are thus encoded in UTF-8...

Encoding HTML in UTF-8 is fine since the HTML code includes <meta http-equiv="Content-Type" content="text/html;charset=utf-8">. But there is no such meta-information for binary files like PNG or JPEG !
I guess the same problem will occur with any formatter that generates a binary file, including PDF.


> Please show us the patch (on the wiki
> MoinMoin:MoinMoinPatch), then we will comment on it.

I've put the patch here :

http://moinmoin.wikiwikiweb.de/MoinMoinPatch/SupportDifferentCharset


> Feel free to add your formatter to MoinMoin:FormatterMarket.

My formatter is very specific to my card design, so i fear it is of little interest...

Jiba




More information about the Moin-user mailing list