Spanish language chars are not displayed properly?

拟墨画扇 提交于 2019-12-11 00:03:50

问题


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 .

(see some junk char after Tel). i am using IE browser.

Do i need to configure any further settings? Thanks!


回答1:


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.

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




回答2:


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.


来源:https://stackoverflow.com/questions/10814692/spanish-language-chars-are-not-displayed-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!