Re: [xml2po] UnicodeDecodeError of trunk



У сре, 09. 05 2007. у 16:55 +0800, Dongsheng Song пише:

> I'm not have good python skill, thanks for some help.
> 

Hi, 

This patch resolves the problem with non-ASCII chars, but I
don't understand code enough to say why it's so. :)

It seems to me that sometimes, when non-ASCII character is present
somewhere in XML document, it becomes a value of outtxt variable (and
translation) and then, on translation.replace(), exception is trown.
But, I'm unable to create smaller test case so I'm not sure if
explanation is correct.

Can you file a bug against xml2po on http://bugzilla.gnome.org?


Index: xml2po.py
===================================================================
--- xml2po.py   (revision 945)
+++ xml2po.py   (working copy)
@@ -507,7 +507,7 @@
         if mode == 'merge':
             translation = getTranslation(outtxt,
isSpacePreserveNode(node))
         else:
-            translation = outtxt
+            translation = outtxt.decode('utf-8')
 
         starttag = startTagForNode(node)
         endtag = endTagForNode(node)





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]