CDATA wrapping strips backslash escaping of apostrophes in Android XML strings
under review
Michał Skiba
Hi SimpleLocalize team,
I found an inconsistency in how apostrophes are escaped in Android XML strings when HTML tags are present.
Working case (plain text):
When a translation contains an apostrophe without HTML tags, e.g.:
libère de l'espace
After syncing with Android Studio, the output is correctly escaped:
<string name="example">libère de l\'espace</string>
✅ This compiles fine.
Broken case (text with HTML tags):
When the same translation contains HTML tags, e.g.:
libère de <b>l'espace</b>
After syncing, the output wraps in CDATA but drops the backslash escape:
<string name="example"><![CDATA[<b>libère de l'espace]]></string>
❌ This fails to compile because the unescaped apostrophe breaks the Android XML parser.
Expected behavior:
Either:
Escape the apostrophe inside CDATA: l\'espace
Or use XML entity instead of CDATA: libère de <b>l\'espace</b>
Jakub Pomykała
marked this post as
under review