u() function does not support unicode character escapes

Create issue
Issue #2 resolved
Matt Chaput created an issue

If I do:

{{{ six.u("\u1234") }}}

in Python 2.x I should get:

{{{ u'\u1234' }}}

but instead I get:

{{{ u'\uABCD' }}}

Unfortunately the only way I can think of to fix this is to loop through the unicode string with a regular expression and rebuild the string to replace {{{\u([0-9a-fA-F]{4})}}} with {{{unichr(int(match.group(1), 16))}}} if you see what I mean.

Comments (3)

  1. Matt Chaput reporter

    P.S. sorry for the extra message, but I should have added: thanks for six, I think it's going to come in very handy.

  2. Log in to comment