JDK-4418200 : Currency formatting for some locales produces question marks
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 1.3.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2001-02-22
  • Updated: 2001-08-15
  • Resolved: 2001-08-15
Related Reports
Duplicate :  
Relates :  
Description

Name: yyT116575			Date: 02/22/2001


java version "1.3.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)

Hi, I've come across this problem with using the Swedish
("sv", "SE") and French Locale and NumberFormat on NT (this
works correctly on Sun). As well as testing with jdk 1.3.0_01, I
have tested this with the jdk 1.2.2_006.
i.e:

--- BEGIN CODE ---
import java.util.*;
import java.text.*;

public class Test {

  public static void main(String[] args) {

    double value=100000.00;

    Locale l = new Locale("sv","SE");
    NumberFormat nf = NumberFormat.getCurrencyInstance(l);
    System.out.println("Locale sv/SE gives [" + nf.format(value) + "]");

    l = new Locale("fr","FR");
    nf = NumberFormat.getCurrencyInstance(l);
    System.out.println("Locale fr/FR gives [" + nf.format(value) + "]");

    System.exit(0);
  }

}
--- END CODE ---

--- RESULTS ---

On NT gives the following results:
Locale sv/SE gives [100?000,00 kr]
Locale fr/FR gives [100?000,00 F]

on Sun gives:

Locale sv/SE gives [100 000,00 kr]
Locale fr/FR gives [100 000,00 F]

--- END RESULTS ---
(Review ID: 117484) 
======================================================================

Comments
EVALUATION NumberFormat.format for a variety of locales uses the non-breaking space \u00a0 to indicate spaces within a formatted number. This is necessary to enable correct linebreaking and parsing. However, when converting this character to a character encoding used by the host OS, we run into problem 4153167: many versions of Windows uses two different character encodings in parallel, a "Windows code page" for Windows applications, an "OEM code page" for the DOS window. The Java runtime uses the Windows code page, and so text comes out incorrectly when sent to the DOS window. On my US Windows 2000 machine, the \u00a0 characters comes out as "��", but the result will vary depending on the localization. A workaround is to redirect the output into a file and then view the file using a Windows application such as Notepad - it will show the non-breaking space correctly. ###@###.### 2001-08-14
14-08-2001