[Zope3-dev] Re: unicode problems !?
j.kartnaller
j.kartnaller at robotech.at
Mon Oct 11 01:46:48 EDT 2004
Jim Fulton wrote:
> j.kartnaller wrote:
>
>> Albertas Agejevas wrote:
>>
>>> On Fri, Oct 08, 2004 at 01:35:13PM +0200, j.kartnaller wrote:
>>>
>>>> Stephan Richter wrote:
>>>>
>>>>> On Friday 08 October 2004 03:01, j.kartnaller wrote:
>>>>>
>>>>>> If a doc-string contains non ascii data (eg. german umlaut) I get the
>>>>>> following error :
>>>>>>
>>>>>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in
>>>>>> position 4:
>>>>>> ordinal
>>>>>> not in range(128)
>>>>>
>>>>>
>>>>>
>>>>> If you have umlauts in the doc string, you must make it a unicode
>>>>> text. Example:
>>>>>
>>>>> def func():
>>>>> u"""This is the docstring with an umlaut: ü"""
>>>>>
>>>>> The doc tool has no way of guessing the encoding you may have used.
>>>>>
>>>>
>>>> I tried this without a change in the behavior !
>>>
>>>
>>>
>>>
>>> Have you declared the charset at the top of the source file?
>>>
>>> #!/usr/bin/env python
>>> # -*- charset: latin-1 -*-
>>
>>
>>
>> I have the same result with that.
>
>
> That's because it should be:
>
> # -*- coding: latin-1 -*-
>
> Try that.
>
> See: http://www.python.org/peps/pep-0263.html
>
> Jim
>
I'm still having no success.
So I will change to english docstrings :-)
Jürgen
More information about the Zope3-dev
mailing list