Skip to content

Commit 7755492

Browse files
committed
correctly escape special chars in wxl XML
1 parent 9913271 commit 7755492

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

po2wxl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import sys
1414
import textwrap
1515
import os.path
16+
from xml.sax.saxutils import escape
1617

1718
import polib
1819

@@ -165,9 +166,9 @@ def usage():
165166
f.write("\n")
166167
f.write(" <!--" + entry.comment.replace('\n', ' -->\n <!--') + " -->\n")
167168
if entry.msgstr != "":
168-
translation = entry.msgstr
169+
translation = escape(entry.msgstr)
169170
else:
170-
translation = entry.msgid
171+
translation = escape(entry.msgid)
171172
translation = "&#13;&#10;".join(translation.split("\n")).replace('\r', '').encode("utf-8")
172173
f.write(" <String Id=\"" + entry.msgctxt.encode("utf-8") + "\">" + translation + "</String>\n")
173174

0 commit comments

Comments
 (0)