United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4163515 : -Dfile.encoding option doesn't affect default ByteToChar converter

Details
Type:
Bug
Submit Date:
1998-08-05
Status:
Closed
Updated Date:
2005-02-25
Project Name:
JDK
Resolved Date:
1998-08-11
Component:
hotspot
OS:
solaris_9,solaris_2.6,windows_nt,linux,generic,windows_2000
Sub-Component:
runtime
CPU:
x86,sparc,generic
Priority:
P2
Resolution:
Not an Issue
Affected Versions:
1.2.0,1.3.0,1.4.1,1.4.2,1.4.2_08
Fixed Versions:

Related Reports
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Relates:
Relates:
Relates:

Sub Tasks

Description
In JDK1.2fcs, even if you set -Dfile.encoding option, 
it doesn't affect ByteToChar converter.
In case of JDK1.2beta4, -Dfile.encoding option affects
both ByteToChar converter and CharToByte converter.
	
Run the following program.

--- program ---
import sun.io.CharToByteConverter;
import sun.io.ByteToCharConverter;

public class DefaultEncoding {
    public static void main (String args[]) {
        System.out.println(ByteToCharConverter.getDefault().toString());
        System.out.println(CharToByteConverter.getDefault().toString());
    }
}

--- result ---
Win32, JDK1.2fcs_D:
C:\>java DefaultEncoding
ByteToCharConverter: SJIS
CharToByteConverter: SJIS

C:\>java -Dfile.encoding=EUC_JP DefaultEncoding
ByteToCharConverter: SJIS
CharToByteConverter: EUC_JP

Win32, JDK1.2beta4_K:
C:\>java DefaultEncoding
ByteToCharConverter: SJIS
CharToByteConverter: SJIS

C:\>java -Dfile.encoding=EUC_JP DefaultEncoding
ByteToCharConverter: EUC_JP
CharToByteConverter: EUC_JP


                                    

Comments
EVALUATION

This is not a bug.  The "file.encoding" property is not required by the J2SE
platform specification; it's an internal detail of Sun's implementations and
should not be examined or modified by user code.  It's also intended to be
read-only; it's technically impossible to support the setting of this property
to arbitrary values on the command line or at any other time during program
execution.

The preferred way to change the default encoding used by the VM and the runtime
system is to change the locale of the underlying platform before starting your
Java program.

###@###.### 2005-2-25 19:22:03 GMT
                                     
2005-02-25



Hardware and Software, Engineered to Work Together