|
From: <fri...@us...> - 2009-05-16 06:59:15
|
Revision: 9739
http://zaf.svn.sourceforge.net/zaf/?rev=9739&view=rev
Author: friedelwolff
Date: 2009-05-16 06:58:50 +0000 (Sat, 16 May 2009)
Log Message:
-----------
Work with unicode characters to encode them to the escaped code points. Otherwise we get multiple unicode code points for each character in the UTF-8 byte stream.
Modified Paths:
--------------
trunk/locale/locale-escape
Modified: trunk/locale/locale-escape
===================================================================
--- trunk/locale/locale-escape 2009-05-15 08:16:59 UTC (rev 9738)
+++ trunk/locale/locale-escape 2009-05-16 06:58:50 UTC (rev 9739)
@@ -48,11 +48,11 @@
string = re.sub('\n', "", string)
newstring = ""
if not blank.search(string):
- newword = string
- for char in re.sub("<U[\dA-F]{4,4}>", "", string):
+ newword = string.decode('utf-8')
+ for char in re.sub("<U[\dA-F]{4,4}>", "", newword):
encode = "<U%04X>" % (ord(char))
newword = re.sub(char, encode, newword)
- newstring = newstring + newword
+ newstring = newstring + newword.encode('utf-8')
line = re.sub(string, newstring, line)
#print "'%s' %s\n%s\n" % (string, newstring, line)
print line,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|