[Patches] Unicode Character Name codec support

M.-A. Lemburg mal@lemburg.com
Fri, 12 May 2000 15:06:01 +0200


Bill Tutt wrote:
> 
> > > Any thoughts on replacing the unicode-escape stuff with this?
> >
> > I'd rather not: unicode-escape is needed by the compiler
> > and that would mean having link the hash table to the
> > interpreter.
> >
> 
> Well, I mentioned it since I think Perl's built in Unicode stuff supports
> it, and you won't have a working set hit if you never use the feature.

Ok, but it's really just one call away :-) ...

s = unicode('\N{LATIN SMALL H}', 'unicode-named')

> It would also be possible to dynamically link to the hash table data by
> using shared library stuff, and only doing so when someone actually passes
> in a \N{LATIN SMALL LETTER H}.

Hmm, you could probably extend the builtin unicode-escape
codec to import the needed tables on-demand (and via the
standard Python import APIs) when the codec sees a \N
escape. A bit tricky to do in C, but certainly possible.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/