Skip to content

Commit

Permalink
correctly escape special chars in wxl XML
Browse files Browse the repository at this point in the history
  • Loading branch information
sblaisot committed Jul 9, 2017
1 parent 9913271 commit 7755492
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions po2wxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import sys
import textwrap
import os.path
from xml.sax.saxutils import escape

import polib

Expand Down Expand Up @@ -165,9 +166,9 @@ def usage():
f.write("\n")
f.write(" <!--" + entry.comment.replace('\n', ' -->\n <!--') + " -->\n")
if entry.msgstr != "":
translation = entry.msgstr
translation = escape(entry.msgstr)
else:
translation = entry.msgid
translation = escape(entry.msgid)
translation = "&#13;&#10;".join(translation.split("\n")).replace('\r', '').encode("utf-8")
f.write(" <String Id=\"" + entry.msgctxt.encode("utf-8") + "\">" + translation + "</String>\n")

Expand Down

0 comments on commit 7755492

Please sign in to comment.