java - Servlet Globalization NumberFormat.getCurrencyInstance(Locale.JAPAN) doen't work properly -


i came across following issue when have been practicing on java servlet globalization:

numberformat.getcurrencyinstance(locale.uk)

is working while

numberformat.getcurrencyinstance(locale.japan)

is showing '?' instead of '‎¥'.

here code:

protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception {         response.setcontenttype("text/html");         printwriter out = response.getwriter();          out.println("<html>");         out.println("<head>");         out.println("<title>detecting locale </title>");         out.println("</head>");         out.println("<body>");          long number = 5_000_000l;          numberformat numforuk = numberformat.getcurrencyinstance(locale.uk);         out.println("<p>format currency uk locale: " + numforuk.format(number) + "</p>");          numberformat numforjapan = numberformat.getcurrencyinstance(locale.japan);         out.println("<p>currency format using japan locale: " + numforjapan.format(number));          out.println("</body>");         out.println("</html>");     } 

output on google chrome:

format currency uk locale: £5,000,000.00

currency format using japan locale: ?5,000,000

please me out solve problem. thank you!

try instead of response.setcontenttype("text/html"); response.setcontenttype("text/html; charset=utf-8");


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -