Skip to content

Commit

Permalink
Found Unicode_escape decoder of Python3.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Oct 15, 2012
1 parent df6a48b commit 992b291
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clj.py
Expand Up @@ -45,6 +45,8 @@
except ImportError:
from io import StringIO

import codecs

def number(v):
if '.' in v:
return float(v)
Expand Down Expand Up @@ -188,8 +190,8 @@ def __read_token(self):
cp = c
c = fd.read(1)
e = c
#v = u''.join(buf).decode('unicode-escape')
v = ''.join(buf).encode('utf_8').decode('unicode_escape') ##py3k bug?
v = codecs.getdecoder('unicode_escape')(u''.join(buf))

else:
if c not in _COLL_CLOSE_CHARS:
raise ValueError('Unexpected char: '+c)
Expand Down

0 comments on commit 992b291

Please sign in to comment.