[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3/src/zope/app/content -
folder.py:1.3
Florent Guillaume
fg@nuxeo.com
04 Feb 2003 13:04:37 +0100
On Mon, 2003-02-03 at 03:01, R. David Murray wrote:
> Florent Guillaume <fg@nuxeo.com> writes:
> >On Fri, 2003-01-17 at 20:18, R. David Murray wrote:
> >> >> + try: unicode(name)
> >> >> + except UnicodeDecodeError:
> >> >> + raise TypeError("Name may not contain non-7-bit-ascii codes")
> [...]
> >Corner case though: if the user has managed to set his default encoding
> >to something like latin-1, you'll still store a non-unicode string with
> >non-7-bit characters.
> >
> >How about a simple
> > try:
> > name = unicode(name)
> > except UnicodeError:
> > ...
>
> Thus forcing/storing all ids as unicode strings? That might be
> reasonable, but perhaps there is a design reason why ASCII ids
> need to be allowed?
There may be performance reasons I don't know about.
Or one could have a regexp explicitely checking for ASCII, like
re.compile('^[ -~]*$')
I think it's really best to be certain we store non-7-bit ascii names
using Unicode, so that charset conversion is done once and for all.
Florent
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com