Fix bytes/unicode detection
https://github.com/behdad/fonttools/pull/233
This commit is contained in:
parent
73031d5a63
commit
034ed355de
@ -25,11 +25,14 @@ class XMLWriter(object):
|
||||
|
||||
# Figure out if writer expects bytes or unicodes
|
||||
try:
|
||||
self.file.write(tounicode(''))
|
||||
self.totype = tounicode
|
||||
except TypeError:
|
||||
# The bytes check should be first. See:
|
||||
# https://github.com/behdad/fonttools/pull/233
|
||||
self.file.write(b'')
|
||||
self.totype = tobytes
|
||||
except TypeError:
|
||||
# This better not fail.
|
||||
self.file.write(tounicode(''))
|
||||
self.totype = tounicode
|
||||
self.indentwhite = self.totype(indentwhite)
|
||||
self.newlinestr = self.totype('\n')
|
||||
self.indentlevel = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user