Special characters are not escaped inside CDATA

Here’s what I get when I download this translation:

<string name="task_blackberry_start"><![CDATA[...commence aujourd'hui...]]></string>

It doesn’t compile. The apostrophe must be escaped:

<string name="task_blackberry_start"><![CDATA[...commence aujourd\'hui...]]></string>

Hello, thanks for reporting!

Do you use CLI or Localazy Gradle plugin?

Localazy CLI, v1.3.1

Would you be please so kind to send me the file with CDATA and your localazy.json (no need to send keys) to vaclav@localazy.com? I would use it for testing.

For Android XML with CDATA, I have several tests and all passes, so there may be a forgotten edge case. But I believe that escaping chars should be okay - everything in CDATA should be preserved as-is.

I analyzed the issue and it’s technically not a bug - the content of CDATA is kept untouched - no additional transformations are applied. It is as it should be - CDATA should be always preserved.

While it works perfectly with all XML-based file formats, Android needs some extra care, and so I introduced one small transformation also for the CDATA section.

The fix should be already available in production, so just please reupload your source language and redownload translations. It should work well.

2 Likes

You’re right, it’s probably an Android issue. Thank you for the fix.

1 Like