tolgee-platform icon indicating copy to clipboard operation
tolgee-platform copied to clipboard

Escaping apostrophes within html tags in Android XML exports

Open stefan-mitrik opened this issue 4 months ago • 2 comments

Describe the bug When exporting translations in Android .xml format, special characters such as apostrophes (') are automatically escaped (works as expected). However, in strings containing html tags (such as <b></b>), the apostrophes are not escaped.

Example

<string name="hydration_description">
  <b>L'hydratation</b>
   est le pourcentage de volume de boissons comptabilisé dans l\'objectif.
</string>

The apostrophe in L'hydratation is not escaped because it's within the <b></b> tags.

Expected behavior The apostrophe within tags should be escaped.

stefan-mitrik avatar Aug 14 '25 09:08 stefan-mitrik

Hi! Thanks for the report! Sorry for the delay. I was able to reproduce the issue. Interestingly, Android Studio doesn't mark it as an error. It only fails when you try to compile the project. Looking at the code, I see it was implemented this way from the start. Since Tolgee added support for escaping Android strings, all apostrophes not directly under the root node () are intentionally not escaped. I'll ask my colleague @JanCizmar why it was done this way. There might be a reason, though I agree it's broken in its current state.

Anty0 avatar Sep 02 '25 15:09 Anty0

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 03 '25 02:10 github-actions[bot]