|
Quick Lists
|
|
Bug ID:
|
4153167
|
|
Votes
|
10
|
|
Synopsis
|
RFE: separate between ANSI and OEM code pages on Windows
|
|
Category
|
java:char_encodings
|
|
Reported Against
|
1.1
, 1.3
, 1.1.4
, 1.1.7
, 1.2.1
, 1.3.1
, arrow
, tiger-beta2
, orion3windows_rr
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Will Not Fix,
request for enhancement
|
|
Priority:
|
5-Very Low
|
|
Related Bugs
|
6288485
,
4094370
,
4229169
,
4279804
,
4310713
,
4418200
,
4511987
,
6526590
,
6549619
,
6845087
,
6845405
,
6861703
,
5046759
,
4369481
|
|
Submit Date
|
29-JUN-1998
|
|
Description
|
Windows has _two_ code pages that are used in any non Asian locale. There is the "ANSI" codepage used by any GUI code and there is the "OEM" codepage used by DOS based things such as the DOS shell.
The VM picks the ANSI codepage for the default on startup. This means that System.out.println() uses the wrong codepage when it is attached to a DOS console window.
The following will demonstrate:
// Run this on a US version of Windows
import java.awt.*;
import com.sun.java.swing.*;
import java.io.*;
public class HelloWorldFrame extends JFrame
{
JButton jButton1 = new JButton();
public HelloWorldFrame()
{
this.getContentPane().add(jButton1, BorderLayout.CENTER);
}
public static void main(String[] args) throws Exception
{
HelloWorldFrame helloWorldFrame1 = new HelloWorldFrame();
//String umlaut = "÷õ³ÍŽ›œ";
String umlaut = "\u00f6\u00e4\u00fc\u00d6\u00c4\u00dc\u00df";
helloWorldFrame1.jButton1.setText(umlaut);
System.out.println (umlaut);
PrintWriter out = new PrintWriter( new OutputStreamWriter(System.out,
"Cp437"),
true );
// Does the right thing
out.println(umlaut);
// Does the wrong thing
System.out.println(umlaut);
helloWorldFrame1.pack();
helloWorldFrame1.show();
}
}
xxxxx@xxxxx 1998-06-29
|
|
Work Around
|
N/A
|
|
Evaluation
|
Could use GetConsoleCP() to determine OEM code page.
xxxxx@xxxxx 1999-04-12
In 6.0 we added a Console class which pick the code page used by the
underlying console/dos prompt
Posted Date : 2006-02-01 06:26:46.0
As suggested above, the new JDK6 java.io.Console class uses OEM codepage on
Windows platform when dealing with the DOS prompt/command line on windows.
It's definitely too late to change System.in/out/err to use OEM codepage though.
So I closed this one as "will not fix"
Posted Date : 2006-11-06 22:32:46.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |