[I18n-sig] (no subject)

Tom Emerson tree@basistech.com
Fri, 24 Aug 2001 13:03:51 -0400


Colin Yu writes:
> Is there a way to take a unicode string like u"=E3=1B,C,=1B(B=E3=1B,C=
<=1B(B=E3=1B,B6=1B(B=E3=1B,C<=1B(B =E3=83=97=E3=1B,C*=1B(B=E3=1B,C3=1B(=
B=E3=1B,B=3F=1B(B"=20
> (which are Japanese characters in UTF-8 format) and convert it to uni=
code=20
> (\uXXXX format) escape codes in python=3F  Your help would be greatly=
=20
> appreciated. Thank you.

Use "repr".

>>> foo =3D u"\u4e00"
>>> repr(foo)
"u'\\u4E00'"

--=20
Tom Emerson                                          Basis Technology C=
orp.
Sr. Sinostringologist                              http://www.basistech=
.com
  "Beware the lollipop of mediocrity: lick it once and you suck forever=
"