texterify icon indicating copy to clipboard operation
texterify copied to clipboard

Special characters in properties

Open krisrefs opened this issue 3 years ago • 3 comments

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.

krisrefs avatar Jan 17 '22 22:01 krisrefs

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? 🙂

chrztoph avatar Jan 20 '22 16:01 chrztoph

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?

krisrefs avatar Jan 20 '22 17:01 krisrefs

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?

chrztoph avatar Feb 14 '22 19:02 chrztoph