Escaped backslash character not getting escaped enough

Hi,

We had a case of a need to display a backslash in our displayed text. Initially we would have thought just a string with Display this \\ to expect “Display \” but in iOS it needs to be exported to the strings file as Display \\\\ for it to be correctly processed as “Display \” on the UI (NSLocalizedStringKey, and LocalizedStringKey).

Can there be an additional handling for these cases for double-escaped characters like the backslash "", and maybe the backtick ```, and other special escaped characters. This is so far the only string that we have that we have to create 2 different keys just to support Android and iOS displaying the text correctly.

Hi @rollyceballos !
do you have one source file and on export you expect to receive two different (android and ios) or you have both as source file? What format of escaping do you have in your source file?

Hi @Ira the key for this string we store in one source file. Let’s say

CustomerScreen

  • c_message = "We need to show \\"

This gets exported to Android and iOS as the same string

ANDROID:
<string name="c_message">We need to show \\</string>

iOS:
"c_message" = "We need to show \\";

For Android the single escape backslash is enough to make it show on the app as “We need to show \”

For iOS it will end up just "We need to show "

We currently need to create 2 keys for the same set of localizable string and have to enter

"c_message" = "We need to show \\\\";

for it to show correctly in iOS as “We need to show \”

Let me know if I got the details clear.

Hi!
You can try to enable the Unify placeholders options in the project settings that we have for the iOS and Android localization within a Single project:

Or another way is to try to use Bundles for iOS and Android export:

Feel free to test it in your project and let us know if you still need our help

Hi Tetiana, I may be misunderstanding your suggestion but we already have these in place I believe. You may have thought we were managing our strings separately but we don’t.

The issue is that CrowdIn exports the string with escaped backslash without considering what’s valid for iOS.

If we kept using the shared key exported to Android and iOS, iOS will not get the correct string to display.

As mentioned, if we have this key:

CustomerScreen

  • c_message = "We need to show \\"

This gets exported to Android and iOS as below

ANDROID:
<string name="c_message">We need to show \\</string>

iOS:
"c_message" = "We need to show \\";

These will be displayed fine on Android, but not on iOS.

Would you mind providing additional project details to support@crowdin.com? This should include the project’s name and a link to the specific string in question, which will enable us to review it thoroughly.

Thanks Natalia. Please check your inbox :+1: