PDF = 4
WEAK_WS_IS_NEWLINE = 2
-import unimap
-import specmap
+from Texml import unimap
+from Texml import specmap
import codecs
import os
import sys
import string
+if sys.version_info[0] >= 3:
+ byteord = lambda c: c
+else:
+ byteord = ord
+
#
# Writer&Co class
#
if always_ascii:
encoding = 'ascii'
self.stream = stream_encoder(stream, encoding)
- except Exception, e:
+ except Exception as e:
raise ValueError("Can't create encoder: '%s'" % e)
# Continue initialization
self.after_char0d = 1
try:
bytes = ch.encode(self.encoding)
for by in bytes:
- self.write('^^%02x' % ord(by), 0)
+ self.write('^^%02x' % byteord(by), 0)
return
- except Exception, e:
+ except Exception as e:
pass
#
# Symbol have to be rewritten. Let start with math mode.
""" Write char in Acrobat utf16be encoding """
bytes = ch.encode('utf_16_be')
for by in bytes:
- self.write('\\%03o' % ord(by), 0)
+ self.write('\\%03o' % byteord(by), 0)
#
# Wrapper over output stream to write is desired encoding