JDK-5036333 : There must be in the JNLP file a way to specify the file.encoding property
  • Type: Enhancement
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2004-04-22
  • Updated: 2004-08-27
  • Resolved: 2004-08-27
Related Reports
Duplicate :  

Name: rmT116609			Date: 04/22/2004

Since JVM1.4.2, file.encoding property is read only (see bug 4163515) :
it can be changed but will not affect the behaviour of encoding/decoding.

However, many applications need a way to specify with which file.encoding they must be launched (for example UTF8).

Before JVM 1.4.2, developers were able to specify a system property in the jnlp file:

<j2se version="1.4"/>
<property name="file.encoding" value="UTF8"/>

but in 1.4.2 jvm, this does not work.
The property is not passed on the command line (-Dfile.encoding=value)
and then has no effect on encodig/decoding.

So since 1.4.2, there is no way to specify the encoding that must be used with the application, within the JNLP file.

Many applications rely on a specific encoding (usually UTF8, ISO etc). These applications that are deployed with Java Web Start must be able to to specify in the JNLP file the encoding.

The JNLP file must define a way to define the encoding : two possible choices :

<j2se version="1.4"/>
<property name="file.encoding" value="UTF8"/>

Java web start will detect that file.encoding is a special system property and then must launched the JVM with -Dfile.encoding=UTF8 instead of doing a System.setProperty("file.encoding", "UTF8")

2/ a new parameter is included in the j2se jnlp tag :

<j2se version="1.4" file-encoding="UTF8"/>

and then the jvm will be started with -Dfile.encoding="UTF8" param.
Personnaly, I prefer this solution rather than the first one, because in jvm 1.4.2 file.encoding is not just a simple system property but a jvm param representation.

In JVM 1.4.1, setting
<property name="file.encoding" value="UTF8"/>
works fine

In JVM 1.4.2 it has not effect on the encoding behaviour

---------- BEGIN SOURCE ----------
The simplest way to test is to create a small UTF8 file that will contain french character and greek character.

This file is read, decoded, and then saved. Normally, if the JVM is using the UTF8 encoding, the output file and input file must be exactly the same. If another encoding is used, greek character will be replaced by '?' characters in the output file.
---------- END SOURCE ----------

Use JVM 1.4.1 and set <property name="file.encoding" value="UTF8"/> in the JNLP file.

No workaround known with jvm 1.4.2 and later.
(Incident Review ID: 233430) 

EVALUATION file.encoding should be added to the list of "trusted" properties. ###@###.### 2004-05-26 in accordance with the comments of ###@###.###, on bug 4163515, I am closing this as a dupe of 4163515