Michael
Michael

Reputation: 33297

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.

Upvotes: 1

Views: 1538

Answers (2)

Igor Klimer
Igor Klimer

Reputation: 15321

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.

Upvotes: 2

El Hoss
El Hoss

Reputation: 3832

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

Upvotes: 1

Related Questions