Skip to content
This repository has been archived by the owner on Oct 15, 2021. It is now read-only.

Transifex breaks XML entities #267

Open
tomer opened this issue Aug 23, 2013 · 4 comments
Open

Transifex breaks XML entities #267

tomer opened this issue Aug 23, 2013 · 4 comments

Comments

@tomer
Copy link

tomer commented Aug 23, 2013

Please don't escape XML/HTML entities by replacing "&" with "& amp;" automatically. While it could be good for some projects, it breaks every string that contain an entity that should never be re-escaped.

For example, a string that contains "&brandShortName;" should never ever be encoded to "& amp;brandShortName;".

screenshot

NOTE: I've added spaces after the ampersand characters because both are displayed the same the correct and wrong strings displayed the same. Of course, there is no spaced entities in the source files… ☺

@tomer
Copy link
Author

tomer commented Aug 23, 2013

This also reproduce on other entities as well. In the screenshot below you can see an entity that contain some HTML markup, which gets destroyed after exporting the strings.

screenshot2

Transifex output is on the left pane, and these strings have imported and exported without being changed by human inside the Transifex site.

@tomer
Copy link
Author

tomer commented Aug 24, 2013

Workaround: Run the following bash snippet after pulling the translations to fix double-encoded entities.

find . -type f -name "*.dtd" -exec sed -i "s/\&\([a-zA-Z0-9\.]*\);/\&\1;/g" {} \;

CAUTION: This won't fix HTML tags being broke by Tx into entities as seen in the second screenshot above.

Edit: I've filed a support ticket on this problem here: http://support.transifex.com/customer/portal/questions/1476514

@grote
Copy link

grote commented Nov 11, 2013

I have this problem with Android strings.xml files that use HTML inside strings:

< string name="about" >this is < b >bold< /b >.< /string >

@martinbonnin
Copy link

I just bumped into this. The problem is still there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants