[cffLib] fix "TypeError: cannot use a string pattern on a bytes-like object"
This is just to make the tests pass, otherwise the following re.sub call fails with TypeError on Python 3. However, I wonder why we need to replace all newlines with spaces in 'Notice' and 'Copyright' fields? ``` if name in ['Notice', 'Copyright']: value = re.sub(r"[\r\n]\s+", " ", value) ``` We shall ask Read about this.
This commit is contained in:
parent
0fc9313e79
commit
ca235ea8a1
@ -1031,9 +1031,10 @@ class Latin1Converter(SimpleConverter):
|
||||
def write(self, parent, value):
|
||||
return tobytes(value, encoding='latin1')
|
||||
def xmlWrite(self, xmlWriter, name, value, progress):
|
||||
value = tounicode(value, encoding="latin1")
|
||||
if name in ['Notice', 'Copyright']:
|
||||
value = re.sub(r"[\r\n]\s+", " ", value)
|
||||
xmlWriter.simpletag(name, value=tounicode(value, encoding="latin1"))
|
||||
xmlWriter.simpletag(name, value=value)
|
||||
xmlWriter.newline()
|
||||
def xmlRead(self, name, attrs, content, parent):
|
||||
return tobytes(attrs["value"], encoding=("latin1"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user