[Zope] Re: Problem with WebDAV and non-ascii titles

Pawel Lewicki lewicki at provider.pl
Tue Apr 1 11:18:59 EDT 2008


Dieter Maurer wrote:
> Pawel Lewicki wrote at 2008-3-28 15:52 +0100:
>> I have a problem with accessing files with non-ascii titles via Enfold 
>> Desktop (WebDAV)- Zope 2.10.4).
>>
>> Traceback (innermost last):
>>   Module ZPublisher.Publish, line 119, in publish
>>   Module ZPublisher.mapply, line 88, in mapply
>>   Module ZPublisher.Publish, line 42, in call_object
>>   Module webdav.Resource, line 286, in PROPFIND
>>   Module webdav.davcmds, line 124, in apply
>>   Module OFS.PropertySheets, line 344, in dav__allprop
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 47: 
>> ordinal not in range(128)
> 
> WebDAV is XML technology, therefore essentially unicode.
> 
> Apparently, your "title"s are plain strings. Therefore,
> Python needs to convert them to unicode at the WebDAV boundary.
> Obviously, an encoding is necessary to do this -- and
> as no explicit encoding is given, Python's defaultencoding
> is used (which defaults to "ascii").
> 
> 
> The most proper solution would be to make your "title"s unicode.
> 
> If all your plain strings use a common encoding, then
> you can set Python's defaultencoding to this encoding.
> You must do that at startup (e.g. in "sitecustomize.py"),
> as "setdefaultencoding" is removed from "sys" after startup.


Thanks a lot.

-------
ZOPE_INSTANCE/lib/python/sitecustomize.py :

import sys
sys.setdefaultencoding('utf-8')

-------

works like a charm.

Pawel Lewicki



More information about the Zope mailing list