Commit c8b10eda authored by Nicolas Delaby's avatar Nicolas Delaby

Convert strings into UTF-16BE according PDF Reference 1.7

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19419 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3b672f9e
......@@ -159,8 +159,13 @@ class PDFTk:
def _escapeString(self, value) :
if value is None :
return ""
string = str(value)
return ''
#Convert value to string
#See PDF Reference v1.7 - 3.8.1 String Types
if isinstance(value, unicode):
string = '\xfe\xff' + value.encode('utf-16BE')
else:
string = '\xfe\xff' + unicode(str(value), 'utf-8').encode('utf-16BE')
escaped = ''
for c in string :
if (ord(c) == 0x28 or # open paren
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment