GNOME Bugzilla – Bug 437371
[xml2po] UnicodeDecodeError of trunk
Last modified: 2019-03-25 23:13:43 UTC
Steps to reproduce: python xml2po.py -e -o defguide5.pot defguide5-r6802.xml Stack trace: Traceback (most recent call last):
+ Trace 133422
doSerialize(doc)
outtxt += doSerialize(child)
(starttag, content, endtag, translation) = processElementTag(node, repl, 1)
translation = translation.replace('<placeholder-%d/>' % (i), replacement)
635: ordinal not in range(128) Other information: The test xml file at: http://i18n-zh.googlecode.com/files/defguide5-r6802.xml.bz2
Created attachment 87992 [details] [review] Working patch 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.
This bug report should be moved to general component of xml2po http://bugzilla.gnome.org/buglist.cgi?product=xml2po&bug_status=NEW&component=general
Any chance of getting a minimal test-case for this (to add to xml2po/tests/)? ;) Thanks for the report and patch, guys.
Created attachment 96746 [details] [review] really working patch sometimes some attributes in opening tag could contain non-ascii chars too. This patch could solve that problem as well.
'Working patch' is good, but 'really working patch' can't work well for http://i18n-zh.googlecode.com/svn/trunk/doc/defguide5/xml/defguide5.xml .
*** Bug 510128 has been marked as a duplicate of this bug. ***
Fixed in svn trunk, please reopen if it reappears.
*** Bug 441073 has been marked as a duplicate of this bug. ***