[Doc-SIG] German Umlauts

Christian Tismer tismer at tismer.com
Wed Jul 9 04:11:50 EDT 2003

grubert at users.sourceforge.net wrote:

> On Mon, 7 Jul 2003, Christian Tismer wrote:


>>How do I change the encoding for Zope?
> how do you call docutils,

I have no idea, I just use the ZWiki with it.

> 2. if you use html.py (maybe not a bad idea, let zope cache the page and decide
>    when remake is necessary) use commandline or the configuration file.

I think this is nothing I should need to know when using a Zope product.


>>Is it possible to set that per page, or do I have to set something by
>>environment variables, global for Zope?
> depends :-)

Very enlighting. Depends on what?

>>What would be the most flexible default encoding for a multilingual website?
> depends on the assumed clients i would say utf-8 might support the widest
> span of characters but i am unsure about the number of browser supporting
> it.
> what is multilingual: english, görmän, ...

Here my result, after reading lots of code, more or less
out-dated suggestions, and finally looking into
/etc/python2.1/site.py :

I set my debian server to use LAND="de_DE". There was some
suggestion to use "de_DE at euro", but this encoding was not
found in the python encoders. Seems also to be not needed,
the Euro sign works just fine this way.

The crucial thing was not to add a customized sitecustomize.py
which didn't work (somebody suggests it somewhere, but it doesn't
work). Instead, there are options provided in site.py, already,
and changing a single line did the job for me:

     252 if 01:     <---- here, this enables what we need
     253     # Enable to support locale aware default string encodings.
     254     import locale
     255     loc = locale.getdefaultlocale()
     256     if loc[1]:
     257         encoding = loc[1];

Without doing that, by using a single non-ASCII character,
a reStructuredText ZWiki page barfs with an ugly traceback,
which finally just says "UnicodeError".

I think it would be worth adding a better message which tells
the administrator that he should enable unicode handling by
providing some default encoding.
This is possible by either doing the site.py change,
or one can set two environment variables, for instance
in /etc/zope/zopectlrc
There are used in

I have the impression that this is a temporary solution,
since the RST implementation for Zope is quite young.
Having a default for the whole site is fine, but having
the option to define an encoding per Wiki and/or per page
would be much nicer.

Anyway, I'm happy with what is there, already!

cheers - chris
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

More information about the Doc-SIG mailing list