[Zope3-dev] Re: unicode problems !?
Jim Fulton
jim at zope.com
Sun Oct 10 03:37:32 EDT 2004
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
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list