[Python-Dev] 2.2 Unicode questions

Guido van Rossum guido@digicool.com
Thu, 19 Jul 2001 14:36:58 -0400


> > > Note that in this case, the handling of surrogates is needed
> > > to make the unicode-escape encoding roundtrip safe.
> > 
> > I don't understand what this means.  Can you give an example?
> 
> It means that the roundtrip Unicode -> encoding -> Unicode is a
> 1-1 mapping for all Unicode code points. Other examples for 
> roundtrip safe encodings are UTF-8 and UT-16.
> 
> Looking at the code, I found that the unicode-escape encoder
> does not convert Unicode surrogates to \UXXXXXXXX escapes.
> I'll fix that.

Ah.  I had missed the fact that this was a roundtrip for a specific
encoding, the unicode-escape encoding.

--Guido van Rossum (home page: http://www.python.org/~guido/)