Skip to content

Commit

Permalink
[unicode] attempt to import unicodedata2 backport module
Browse files Browse the repository at this point in the history
As suggested by Adam @twardoch in fonttools#83 (comment)
  • Loading branch information
Cosimo Lupo committed Sep 10, 2015
1 parent ae5bc2d commit 6248bbb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Lib/fontTools/unicode.py
Expand Up @@ -30,7 +30,12 @@ def __getitem__(self, charCode):
class _UnicodeBuiltin(object):

def __getitem__(self, charCode):
import unicodedata
try:
# use unicodedata backport to python2, if available:
# https://github.com/mikekap/unicodedata2
import unicodedata2 as unicodedata
except ImportError:
import unicodedata
try:
return unicodedata.name(unichr(charCode))
except ValueError:
Expand Down

0 comments on commit 6248bbb

Please sign in to comment.