After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 437371 - [xml2po] UnicodeDecodeError of trunk
[xml2po] UnicodeDecodeError of trunk
Status: RESOLVED FIXED
Product: gnome-doc-utils
Classification: Deprecated
Component: xml2po
CVS HEAD
Other All
: Normal critical
: ---
Assigned To: Danilo Segan
Danilo Segan
: 441073 510128 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-05-10 07:35 UTC by dongsheng.song
Modified: 2019-03-25 23:13 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
Working patch (450 bytes, patch)
2007-05-11 07:31 UTC, Goran Rakic
committed Details | Review
really working patch (838 bytes, patch)
2007-10-06 09:44 UTC, Zhang Le
none Details | Review

Description dongsheng.song 2007-05-10 07:35:02 UTC
Steps to reproduce:
python xml2po.py -e -o defguide5.pot defguide5-r6802.xml

Stack trace:
Traceback (most recent call last):
  • File "xml2po.py", line 856 in ?
    doSerialize(doc)
  • File "xml2po.py", line 589 in doSerialize
    outtxt += doSerialize(child)
  • File "xml2po.py", line 583 in doSerialize
    (starttag, content, endtag, translation) = processElementTag(node, repl, 1)
  • File "xml2po.py", line 525 in processElementTag
    translation = translation.replace('<placeholder-%d/>' % (i), replacement)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
635: ordinal not in range(128)

Other information:
The test xml file at:
http://i18n-zh.googlecode.com/files/defguide5-r6802.xml.bz2
Comment 1 Goran Rakic 2007-05-11 07:31:58 UTC
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.
Comment 2 Goran Rakic 2007-05-11 07:39:12 UTC
This bug report should be moved to general component of xml2po
http://bugzilla.gnome.org/buglist.cgi?product=xml2po&bug_status=NEW&component=general
Comment 3 Danilo Segan 2007-05-20 22:56:00 UTC
Any chance of getting a minimal test-case for this (to add to xml2po/tests/)? ;)

Thanks for the report and patch, guys.
Comment 4 Zhang Le 2007-10-06 09:44:04 UTC
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.
Comment 5 dongsheng.song 2007-10-12 01:49:28 UTC
'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 .
Comment 6 Claude Paroz 2008-01-17 13:01:54 UTC
*** Bug 510128 has been marked as a duplicate of this bug. ***
Comment 7 Danilo Segan 2008-07-13 23:22:08 UTC
Fixed in svn trunk, please reopen if it reappears.
Comment 8 Vincent Untz 2008-07-22 15:36:34 UTC
*** Bug 441073 has been marked as a duplicate of this bug. ***