txty-io / texterify

The translation and localization management system.
https://texterify.com
Other
175 stars 14 forks source link

Special characters in properties #97

Open krisrefs opened 2 years ago

krisrefs commented 2 years ago

Hey!

I have the issue that my special characters gets converted into unicode characters, and that will not work in our application.

Is there a way to bypass this? Or is there going to be a way to bypass this?

It's currently converting both keys and translations. (Notice I am using java properties files)

FYI; We are using self-hosted docker version.

chrztoph commented 2 years ago

Hey, can you give an example for which special characters get converted into unicode characters? Unicode is more or less the standard so I would also be really interested how this breaks your application? 🙂

krisrefs commented 2 years ago

We have characters like Æ Ø Å and other special languagespecific characters (like Chinese signs).

å fx. get's converted to \u00e5 and ø to \u00f8.

We expect those to come out as Æ Ø Å, both in keys as well as values.

In why this breaks our application, then it's because it can't find the key when a character is converted.

If you still want the conversion, maybe it could be a setting on the export config?

chrztoph commented 2 years ago

Sorry for the late response.

The library we are using for exporting it to a Java .properties file automatically encodes special characters as it seems like it's best practice for .properties files (see https://github.com/jnbt/java-properties#encodings-and-special-chars and https://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load%28java.io.InputStream). Although it is not documented in the README it seems like this escape procedure can be disabled (see https://github.com/jnbt/java-properties/blob/master/lib/java-properties/generating/generator.rb). If this is the case I will add an option to disable this escape procedure but I can't give you a timeline on that. I'm open to pull requests.

Maybe there is a way it also works with escaped characters in your project as it seems to be best practice?