United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4397522 : Read only status of file.encoding varies by platform

Details
Type:
Bug
Submit Date:
2000-12-13
Status:
Closed
Updated Date:
2001-05-24
Project Name:
JDK
Resolved Date:
2001-05-24
Component:
core-libs
OS:
generic
Sub-Component:
java.nio.charsets
CPU:
generic
Priority:
P3
Resolution:
Not an Issue
Affected Versions:
1.3.0
Fixed Versions:

Related Reports
Relates:

Sub Tasks

Description

Name: skT45625			Date: 12/12/2000


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

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



file.encoding is read-only with linux jre 1.3, but Windows
98 1.3 jre allows file.encoding to be set on command line
(both java and javaw).

Example a: In windows 98 'java -Dfile.encoding=bogus foo'
yields "Error occurred during initialization of VM
java/lang/ClassNotFoundException: sun/io/CharToBytebogus"

Example b: Under linux 'java -Dfile.encoding=bogus foo'
yields "Exception in thread "main"
java.lang.NoClassDefFoundError: foo"
(Review ID: 113683) 
======================================================================

                                    

Comments
WORK AROUND



Name: skT45625			Date: 12/12/2000


Because the property accessibility depends on the jvm implementation it is a
weakness in java portability.

I argue for the following:

1. Make all the jvm's treat the file.encoding the same
2. Make file.encoding r/w instead of r-o

Why read/write?  Because in practice many people work with
languages that are not primary to their os, in multiple
languages, and with encodings unspecific to a locale.  By
making file.encoding r/w you are removing a pesky
limitation from such users.

Also- although every library in the world should allow
encoding switching but many, like some jdbc drivers, don't
and file.encoding is the only way to get at it.
======================================================================
                                     
2004-06-11
EVALUATION

This is not a bug. The file.encoding system property is read-only and not listed as one of the system properties which can be changed. The fact that it does on
some platforms should not be relied upon. Please see bug 4163515 for more
information.

Ian.Little@Ireland 5/24/2001
                                     
2001-05-24



Hardware and Software, Engineered to Work Together