[Zope3-dev] zope\app\container\contained.py
E. Frerich
e.frerich at nord-com.net
Wed May 25 17:08:17 EDT 2005
Am 25 May 2005 um 15:52 hat Florent Guillaume geschrieben:
> E. Frerich <e.frerich at nord-com.net> wrote:
> > line 545 of zope\app\container\contained.py contains a testcase ">>>
> > setitem(container, container.__setitem__, 'hello ' + chr(200),
> > item)" which should give back a traceback: " Traceback (most
> > recent call last):
> > ...
> > TypeError: name not unicode or ascii string
> > "
> > but the name parameter is correct:
> > "
> > >>> max=unicode('hello ' + chr(200))
>
> That shouldn't work. You're running with a non-default system default
Oh - what is a "non-default system default"? The "naked" Python has
'ascii' as default but you can customize the default for a Python site. So
my Python site has the default encoding 'cp1252'. All applications - not
only Zope 3 - use this encoding.
IMO Zope 3 should accept other default encodings. And then this test is
not helpful.
Egon
> encoding. In default systems, you'll get:
>
> >>> unicode('hello'+chr(200))
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc8 in position
> 5: ordinal not in range(128)
>
> Which is the correct answer, because chr(200) is a byte and not a
> character per se, and cannot be converted to unicode with additional
> information (its encoding).
>
> Florent
>
> --
> Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
> +33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope3-dev
mailing list