GWT i18n Message Properties does not Display special Character like ß

I use GWT i18n Messages to translate messages:

@DefaultLocale("en")
public interface Messages extends com.google.gwt.i18n.client.Messages {

    @DefaultMessage("Size")
    String size();

}

For German I have the Messages_de.properties file.

size=Größe äüö ÄÖÜ

In one of my UIBinder templates I use

<ui:text with="{messages.size}"/>

When the user's browser is deI get Grösse ÄÖÜ ÄÖÜinstead of Größe äüö ÄÖÜbeing displayed.

My workspace as well as my .properties file is set to UTF8.

How can I get the special character ß in German being displayed correctly or is there a way to include ASCII code?

Solution: When you set CSS text-transform: uppercase; then ß is transformed to SS.

Answers:

Answer

This is a problem with the way Eclipse handles properties files. You can set the whole workspace to UTF-8, it will still treat properties files as ISO 8859-1 - because that's the default/expected encoding. However, GWT uses an enhanced properties file format that uses UTF-8 directly (without the need for escaping the characters).

You have to override this setting separately:

Setting encoding for properties files in Eclipse

You can change the default encoding for all *.properties files to UTF-8 there (don't forget to hit the Update button).

But please note that this will mean treating all properties files as UTF-8. So unless you are sure this will not break anything, I'd narrow down the file association for example to *Messages.properties files (if all your translation files have the Messages suffix). Or just use a different editor for editing the properties files.

Answer

GWT is always UTF8. So the easiest way to solve your problem is, to set the encoding of your workspace to utf-8.

Or select your Messages_de.properties, right mouse button and select properties. Use Resources to set the encoding of your property file to utf-8.

enter image description here

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.