[Python-3000] Displaying strings containing unicode escapes

Jim Jewett jimjjewett at gmail.com
Sun May 4 20:01:08 CEST 2008


On 5/1/08, "Martin v. Löwis" <martin at v.loewis.de> wrote:

>  - escaping looks like this:
>   * \r, \n, \t, \\
>   * \xXX for characters from Latin-1
>   * \uXXXX for characters from the BMP
>   * \U00XXXXXX for anything else

>  What I didn't have in my original proposal was escaping of Zs
>  except for space, which then would also escape NBSP, EN QUAD,
>  EM QUAD, THIN SPACE, HAIR SPACE, OGHAM SPACE MARK, etc. Escaping
>  them is fine also. Also, I didn't consider surrogate pairs in
>  UCS-2 builds originally; they should (of course) get represented
>  as-is.

I realize that this is the traditional escape form, but I wonder if it
might be better to just use the character names instead of the hex
character codes.  The names can be written in ASCII, they are
unambiguous, and they are easier to understand than a random hex
value.

-jJ


More information about the Python-3000 mailing list