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 441073 - UnicodeDecodeError from xml2po
UnicodeDecodeError from xml2po
Status: RESOLVED DUPLICATE of bug 437371
Product: gnome-doc-utils
Classification: Deprecated
Component: xml2po
CVS HEAD
Other Linux
: Normal normal
: ---
Assigned To: Danilo Segan
Danilo Segan
Depends on:
Blocks:
 
 
Reported: 2007-05-24 23:40 UTC by Björn Lindqvist
Modified: 2019-03-25 23:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Björn Lindqvist 2007-05-24 23:40:37 UTC
xml2po produces this traceback during build of gdm2:

(cd de/ &&     /home/bjourne/svngnome/install/bin/xml2po -e  /home/bjourne/svngnome/sources/gdm2/docs/C/gdm.xml /home/bjourne/svngnome/sources/gdm2/docs/C/legal.xml > de.po.tmp &&     cp de.po.tmp de.po && rm -f de.po.tmp)
Traceback (most recent call last):
  • File "/home/bjourne/svngnome/install/bin/xml2po", line 856 in ?
    doSerialize(doc)
  • File "/home/bjourne/svngnome/install/bin/xml2po", line 589 in doSerialize
    outtxt += doSerialize(child)
  • File "/home/bjourne/svngnome/install/bin/xml2po", line 583 in doSerialize
    (starttag, content, endtag, translation) = processElementTag(node, repl, 1)
  • File "/home/bjourne/svngnome/install/bin/xml2po", line 525 in processElementTag
    translation = translation.replace('<placeholder-%d/>' % (i), replacement)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 91298: ordinal not in range(128)

Seems like the replacement string ought to be a unicode string.
Comment 1 Pedro Villavicencio 2007-05-25 02:54:49 UTC
hello Bjorn, can you please try to do an update from the svn and see if everything goes fine?, i cannot reproduce this with a recent update from the svn, probably now is fixed, thanks for your report.
Comment 2 Björn Lindqvist 2007-05-27 01:00:23 UTC
The problem is still there. I believe you do not see the problem because your Python has a different defaultencoding than the default ascii. gdm.xml contains an &mdash; character inside a tag which xml2po misses to convert to unicode. 

A simple solution that worked for me was to change:

  translation = translation.replace('<placeholder-%d/>' % (i), replacement)

to

  translation = translation.replace('<placeholder-%d/>' % (i),
                                    replacement.decode('utf-8'))
Comment 3 Danilo Segan 2007-12-16 13:12:14 UTC
There's another UnicodeDecodeError bug in xml2po: I'll be looking into both of these shortly (the trick is coming up with a short test case).
Comment 4 Vincent Untz 2008-07-22 15:36:34 UTC
Looks like it's fixed in bug 437371.

*** This bug has been marked as a duplicate of 437371 ***