-5

I have internationalization support in my App. The issue is in displaying the literals on UI. e.g I have a Chinese literal in my code as 不安全密码! However on browser , the field is shown as ä¸å®å¨å¯ç ï¼

similarly in french langauge, a literal "Très faible" gets displayed as "Tr�s faible"

Appreciate your help..Thanks

Aadil
  • 45
  • 3
  • 11

1 Answers1

0

What you see is the bytes rendered as ISO-8859-1 or similar.

Try setting charset in content-type response.setContentType("text/html; charset=utf-8");, include appropriate meta-tag

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

What are you using to generate that page?

Jan
  • 13,738
  • 3
  • 30
  • 55
  • This is a web App.The issue does not seem to be of UTF-8 because that is already in place.However it seems to be a server side issue. e.g 不安全密码!literal is in my properties file. when I do maven clean install and in the target folder .jar , if I open the properties file , the literal is shown as ä¸å®å¨å¯ç ï¼, which is what gets displayed on browser. – Aadil Dec 18 '15 at 06:22
  • Ah. Did you encode your properties with utf8toascii ? – Jan Dec 18 '15 at 06:35
  • I am writing the property file as : BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(propFile, true)); properties.store(out, null); – Aadil Dec 18 '15 at 09:00
  • 1
    The statement “All Strings in Java are UTF-8” is false. There are a few ways that can be interpreted, but none of them will make that sentence true. – VGR Dec 19 '15 at 17:56
  • @Aadil: and your properties file shows these strange characters? Which editor didi you open that with? As you see 2 strange chars per one french you might just use editor not capable of utf-8? – Jan Dec 19 '15 at 18:02