[Zope] RE: Help with Japanese rendering in Zope...?
Bjorn Stabell
bjorn at stabell.name
Wed Dec 10 22:14:40 EST 2003
Erik wrote:
> Finally found the time to try out dump_obj, and it's showing
> me that everything *should* be stored correctly in Unicode.
> Furthermore, the properties page itself (sample attached)
> does correctly identify the input as UTF-8. However, the
> results of my simple dtml method still show question marks,
> even when I look at the source of the generated page
> (attached, along with the results of dump_obj).
>
> Given that the dtml-method result page *source* shows
> question marks in place of proper Japanese, it suggests to me
> that something isn't returning properly. Perhaps some
> intermediary function is not Unicode-aware and fills in the
> non-ascii chars with question marks?
The only thing I can think of now that could be wrong is that ZPublisher
doesn't encode to the right character encoding. If
RESPONSE.setHeader('content-type', 'text/html;
charset=WHATEVER')
isn't done somewhere, then ZPublisher probably wouldn't know which
character encoding to use. Also (something I forgot), I believe you
have to output a Unicode character early in the page rendering process
in order to trigger this automatic Unicode-encoding functionality of the
ZPublisher. Try putting this first in your DTML method:
<dtml-var "RESPONSE.setHeader('content-type', 'text/html;
charset=WHATEVER')"
><dtml-var "u''"
><dtml-var standard_html_header>
...
If it works, move it into your standard_html_header.
Regards,
--
Bjorn
More information about the Zope
mailing list