user1016403
user1016403

Reputation: 12631

Spanish language chars are not displayed properly?

I am using GWT. i implemented internationalization to support spanish language. but spanish chars are not displayed propertly. Ex: Teléfono Buscar is displayed as . enter image description here(see some junk char after Tel). i am using IE browser.

Do i need to configure any further settings? Thanks!

Upvotes: 2

Views: 2879

Answers (2)

adarshr
adarshr

Reputation: 62623

I suspect this may be due to the fact that your editor isn't using UTF-8 encoding.

If you're using Eclipse, you can configure it to use UTF-8 for *.properties by going to Window > Preferences > General > Content Types.

Just make sure you change the Default encoding value to UTF-8 as shown below.

enter image description here

There will be a similar setting for any text editor, including vi.

Upvotes: 2

Nathan Ryan
Nathan Ryan

Reputation: 13061

Since your strings are coming from a properties file, your ResourceBundle is probably an instance of PropertyResourceBundle, which creates an empty instance of java.util.Properties and then populates the instance by loading the properties file via one of the "load" methods. PropertyResourceBundle has two constructors, one which takes an InputStream and one which takes a Reader. The constructors simply call the corresponding "load" method.

Note that the "load" method that takes an InputStream assumes the character encoding of the properties file is ISO 8859-1 (Latin1). You can solve this problem in two ways:

  1. Ensure the property constructor of PropertyResourceBundle is being called, the one that takes a Reader. Construct the reader using the appropriate character encoding.
  2. Use Unicode escapes (\uxxxx) to encode non-ASCII characters in the properties file.

Upvotes: 1

Related Questions