GNOME Bugzilla – Bug 441073
UnicodeDecodeError from xml2po
Last modified: 2019-03-25 23:13:07 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):
+ Trace 135917
doSerialize(doc)
outtxt += doSerialize(child)
(starttag, content, endtag, translation) = processElementTag(node, repl, 1)
translation = translation.replace('<placeholder-%d/>' % (i), replacement)
Seems like the replacement string ought to be a unicode string.
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.
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 — 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'))
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).
Looks like it's fixed in bug 437371. *** This bug has been marked as a duplicate of 437371 ***