Issue 3823, improved support for 2-byte unicode sequence.

svn: r15182
This commit is contained in:
Peter Landgren 2010-04-17 13:57:51 +00:00
parent ee4f0923aa
commit 487d099611

View File

@ -444,7 +444,6 @@ class RTFDoc(BaseDoc,TextDoc):
self.start_paragraph(style_name) self.start_paragraph(style_name)
self.write_text('\n') self.write_text('\n')
self.end_paragraph() self.end_paragraph()
print
def write_endnotes_ref(self,text,style_name): def write_endnotes_ref(self,text,style_name):
""" """
@ -479,7 +478,12 @@ class RTFDoc(BaseDoc,TextDoc):
for i in text: for i in text:
if ord(i) > 127: if ord(i) > 127:
if ord(i) < 256:
self.text += '\\\'%2x' % ord(i) self.text += '\\\'%2x' % ord(i)
else:
# If (uni)code with more than 8 bits:
# RTF req valus in decimal, not hex.
self.text += '\\uc1\\u%d\\uc0' % ord(i)
elif i == '{' or i == '}' : elif i == '{' or i == '}' :
self.text += '\\%s' % i self.text += '\\%s' % i
else: else: