Hi all ,
I'm trying to display currency in Indian format but I'm getting question marks symbols instead of digits .
Please tell me how to sort out this problem .
Thanks in advance
Hi all ,
I'm trying to display currency in Indian format but I'm getting question marks symbols instead of digits .
Please tell me how to sort out this problem .
Thanks in advance
is pointing in the right direction. Question marks usually mean either (a) the bytes were decoded with the wrong character set so the wrong Unicode code points were produced, or (b) the renderer/font has no glyph for the code points and shows a replacement character. For the next step is to identify which of those two is happening and then fix encoding or fonts accordingly.
A quick diagnosis in Java: print the actual code points and check the JVM file encoding.
String s = someString;
for (int i = 0; i < s.length(); i++) {
System.out.printf("U+%04X ", (int) s.charAt(i));
}
System.out.println("\nfile.encoding=" + System.getProperty("file.encoding")); If the printed code points are ASCII or valid Unicode but still display as question marks, the output encoding or font is wrong. Common fixes: compile source with the right encoding (javac -encoding UTF-8), set servlet/JSP response charset (response.setContentType("text/html; charset=UTF-8")), ensure JDBC connections use the correct characterEncoding (for MySQL add useUnicode=true&characterEncoding=UTF-8), and remember .properties files are ISO-8859-1 by default (use native2ascii or load with an InputStreamReader).
If the glyph itself is missing (for example the Unicode rupee symbol), use a fallback symbol ("Rs." or "INR") or explicitly set the currency symbol when formatting:
Locale in = new Locale("en","IN");
DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(in);
dfs.setCurrencySymbol("Rs.");
DecimalFormat df = (DecimalFormat) NumberFormat.getCurrencyInstance(in);
df.setDecimalFormatSymbols(dfs);
System.out.println(df.format(1234567.89)); These steps separate encoding problems from font/glyph problems and provide practical fixes.
Jump to Post— jwenting 1,905by using a proper character set.
by using a proper character set.
by using a proper character set.
Hi jwenting ,
Can you explain bit more ? How can I do that ?
Thanks
see the documentation for your operating system.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.