Image fixes

svn: r1286
This commit is contained in:
Don Allingham
2003-02-05 13:53:00 +00:00
parent d3f2da3505
commit 7c398503c5
11 changed files with 200 additions and 74 deletions

View File

@@ -278,6 +278,7 @@ _utoa = {
def ansel_to_utf8(s):
"""Converts an ANSEL encoded string to UTF8"""
print s
buff = cStringIO.StringIO()
while s:
c0 = ord(s[0])
@@ -285,18 +286,25 @@ def ansel_to_utf8(s):
head = u' '
s = s[1:]
elif c0 > 127:
if _twobyte.has_key(s[0:2]):
head = _twobyte[s[0:2]]
l2 = s[0:2]
l1 = s[0]
print "----------------------"
if _twobyte.has_key(l2):
head = _twobyte[l2]
s = s[2:]
elif _onebyte.has_key(s[0]):
head = _onebyte[s[0]]
print "two"
elif _onebyte.has_key(l1):
head = _onebyte[l1]
s = s[1:]
print "**8 one",l1,ord(l1),"*",_onebyte[l1],
else:
head = u'\xff\xfd'
s = s[1:]
print "barf"
else:
head = s[0]
s = s[1:]
print head,c0
buff.write(head)
ans = buff.getvalue()
buff.close()