|
Quick Lists
|
|
Bug ID:
|
4163515
|
|
Votes
|
0
|
|
Synopsis
|
-Dfile.encoding option doesn't affect default ByteToChar converter
|
|
Category
|
java:runtime
|
|
Reported Against
|
1.3
, 1.4.1
, 1.4.2
, 1.2fcs
, kestrel
, mantis-beta
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Not a Defect,
bug
|
|
Priority:
|
2-High
|
|
Related Bugs
|
4263816
,
4375816
,
4397522
,
4413998
,
4868507
,
5052844
,
5036333
,
4165411
,
4808414
,
6194148
|
|
Submit Date
|
05-AUG-1998
|
|
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
|
|
Work Around
|
N/A
|
|
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.
xxxxx@xxxxx 2005-2-25 19:22:03 GMT
|
|
Comments
|
Submitted On 04-AUG-2000
satoyan
If we want to set file.encoding to "EUCJIS", or "SJIS",
we can't set it by changing the locale (ex. "ja"),
because "locale" is not "encoding".
To change the "file.encoding" parameter, we need other
option (other than locale) to exactly set the encoding.
Submitted On 09-JUN-2003
oivanov
Thus, JVM is not Unicode-aware program:
for example, Windows XP can use unicode-named chars.
r = new FileInputStream("unicode symbols.txt") rise an error.
Submitted On 15-APR-2005
wwwrun
(This holds true at least for the JRE 1.3.1)
Furthermore, on Windows, the file.encoding seems to be read from the format locale setting, not the real codepage. That is, setting the format locale to e.g. czech on a german system renders a file.encoding setting of Cp1250, even if the ANSI code page is still Cp1252. Some characters are converted incorrectly and e.g. file names cannot be found.
Submitted On 22-AUG-2007
Do you think everyone have to speak only one language?
I don't think so. When a guy speaks Thai, you think he shouldn't use any other language such as Japanese. This is the exactly what you are saying. It's obviously ridiculous. Default encoding is supposed to be modified by user or it will be unusable.
Submitted On 02-SEP-2008
it's really inconvenient.
because linux doesn't use shift-jis as its default language
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |