converting to and from octal escaped UTF--8

Piet van Oostrum piet at cs.uu.nl
Tue Dec 4 08:17:06 EST 2007


>>>>> Michael Goerz <answer654 at 8439.e4ward.com> (MG) wrote:

>MG>         if (ord(character) < 32) or (ord(character) > 128):

If you encode chars < 32 it seems more appropriate to also encode 127.

Moreover your code is quadratic in the size of the string so if you use
long strings it would be better to use join.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list