src/reportlab/lib/codecharts.py
branchpy33
changeset 3796 c9a86549dee7
parent 3794 398ea04239b5
child 3970 28e73decd79f
--- a/src/reportlab/lib/codecharts.py	Tue Nov 19 13:51:41 2013 +0000
+++ b/src/reportlab/lib/codecharts.py	Tue Nov 19 15:28:22 2013 +0000
@@ -17,6 +17,7 @@
 from reportlab.graphics.shapes import Drawing, Group, String, Circle, Rect
 from reportlab.graphics.widgetbase import Widget
 from reportlab.lib import colors
+from reportlab.lib.utils import int2byte
 
 adobe2codec = {
     'WinAnsiEncoding':'winansi',
@@ -149,7 +150,7 @@
 
     def draw(self):
         self.drawLabels()
-        charList = [None] * 32 + list(map(chr, list(range(32, 256))))
+        charList = [None] * 32 + list(map(int2byte, list(range(32, 256))))
 
         #we need to convert these to Unicode, since ReportLab
         #2.0 can only draw in Unicode.
@@ -209,12 +210,12 @@
         if self.encodingName.find('EUC') > -1:
             # it is an EUC family encoding.
             for col in range(1, 95):
-                ch = chr(row + 160) + chr(col+160)
+                ch = int2byte(row + 160) + int2byte(col+160)
                 cells.append(ch)
 ##        elif self.encodingName.find('GB') > -1:
 ##            # it is an EUC family encoding.
 ##            for col in range(1, 95):
-##                ch = chr(row + 160) + chr(col+160)
+##                ch = int2byte(row + 160) + int2byte(col+160)
         else:
             cells.append([None] * 94)
         return cells
@@ -266,7 +267,7 @@
             for y in [4,5,6,7,10,11,12,13,14,15]:
                 for x in range(16):
                     col = y*16+x
-                    ch = chr(row) + chr(col)
+                    ch = int2byte(row) + int2byte(col)
                     cells.append(ch)
 
         else:
@@ -320,7 +321,7 @@
                 charValue = y * 16 + x
                 if charValue > 32:
                     s = String(self.x + x * dx,
-                               self.y + (self.height - y*dy), chr(charValue))
+                               self.y + (self.height - y*dy), int2byte(charValue))
                     g.add(s)
         return g
 
@@ -360,5 +361,3 @@
 
 if __name__=='__main__':
     test()
-
-