[Grok-dev] Re: Understanding unicode

Brandon Craig Rhodes brandon at rhodesmill.org
Fri Aug 31 16:36:47 EDT 2007


Jan Ulrich Hasecke <janulrich.hasecke at web.de> writes:

> zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/Users/
> juh/GrokZoo/parts/app/site.zcml", line 4.0-4.29
>     ZopeXMLConfigurationError: File "/Users/juh/GrokZoo/src/grokzoo/
> configure.zcml", line 4.2-4.27
>     UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4'
> in position 7: ordinal not in range(128)

In the mailing list archives from last week, I think, is my complaint
about getting a similar message when attempting to add Unicode
characters to a Tutorial that I am writing.

The only solution I have found at the moment - which, I have to warn
you, is agreed by everyone to be a quite terrible solution that might
break everything on your system, but which worked fine for me - is to
edit your Python site.py file, which on my system lives at:

   /usr/lib/python2.4/site.py

and on your site probably lives somewhere else (judging from your
traceback), and replace the line:

    encoding = "ascii" # Default value set by _PyUnicode_Init()

in the "setencoding()" function (it's the 357th line in my copy) with
the much more ambitious line:

    encoding = "utf8"

That made the errors go away for me.

Good luck!

-- 
Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon


More information about the Grok-dev mailing list