-
Bug
-
Resolution: Fixed
-
P3
-
1.4.2_02
-
05
-
sparc
-
solaris_8
-
Verified
The attached program outputs UnknownCharacterException in Japanese locale.
REPRODUCE:
(1) Compile the following program with -deprecation.
====>
import java.io.PrintWriter;
import java.net.*;
import java.io.*;
public class DecodeTests {
final static String stringSetUTF =
"\uD800\uDC00";
// a string of surrogate pairs can be expressed as 4 bytes
/* standalone interface */
public static void main(String argv[]) {
String encoded = URLEncoder.encode(stringSetUTF);
}
}
<===
(2) Launch "java DecodeTests" with LANG=ja,
then you will see the below exception.
goedel[38]% java DecodeTests
Exception in thread "main" java.lang.Error: UnknownCharacterException thrown in substititution mode
at sun.io.CharToByteConverter.convertAny(CharToByteConverter.java:160)
at sun.nio.cs.StreamEncoder$ConverterSE.implWrite(StreamEncoder.java:210)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:178)
at java.net.URLEncoder.encode(URLEncoder.java:234)
at java.net.URLEncoder.encode(URLEncoder.java:149)
at DecodeTests.main(DecodeTests.java:15)
Caused by: sun.io.UnknownCharacterException
at sun.io.CharToByteEUC_JP_Solaris.convert(CharToByteEUC_JP_Solaris.java:97)
at sun.io.CharToByteConverter.convertAny(CharToByteConverter.java:139)
... 7 more
NOTE:
1) Locale dependency
If you change the locale to english, the test program seems to work well.
goedel[39]% setenv LANG C
goedel[40]% java DecodeTests
goedel[41]%
2) JDK version dependency
This issue occurs only in 1.4.2(_0X), not in 1.4.1 and 1.5b32.
CONFIGURATION:
OS : SunOS goedel 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60
JDK : 1.4.2_02
java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)
==================================================================
REPRODUCE:
(1) Compile the following program with -deprecation.
====>
import java.io.PrintWriter;
import java.net.*;
import java.io.*;
public class DecodeTests {
final static String stringSetUTF =
"\uD800\uDC00";
// a string of surrogate pairs can be expressed as 4 bytes
/* standalone interface */
public static void main(String argv[]) {
String encoded = URLEncoder.encode(stringSetUTF);
}
}
<===
(2) Launch "java DecodeTests" with LANG=ja,
then you will see the below exception.
goedel[38]% java DecodeTests
Exception in thread "main" java.lang.Error: UnknownCharacterException thrown in substititution mode
at sun.io.CharToByteConverter.convertAny(CharToByteConverter.java:160)
at sun.nio.cs.StreamEncoder$ConverterSE.implWrite(StreamEncoder.java:210)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:178)
at java.net.URLEncoder.encode(URLEncoder.java:234)
at java.net.URLEncoder.encode(URLEncoder.java:149)
at DecodeTests.main(DecodeTests.java:15)
Caused by: sun.io.UnknownCharacterException
at sun.io.CharToByteEUC_JP_Solaris.convert(CharToByteEUC_JP_Solaris.java:97)
at sun.io.CharToByteConverter.convertAny(CharToByteConverter.java:139)
... 7 more
NOTE:
1) Locale dependency
If you change the locale to english, the test program seems to work well.
goedel[39]% setenv LANG C
goedel[40]% java DecodeTests
goedel[41]%
2) JDK version dependency
This issue occurs only in 1.4.2(_0X), not in 1.4.1 and 1.5b32.
CONFIGURATION:
OS : SunOS goedel 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60
JDK : 1.4.2_02
java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)
==================================================================
- relates to
-
JDK-4892738 Migrate PCK and eucJP-Open converters to use NIO charset API
- Resolved
-
JDK-6526088 UnknownCharacterException thrown in substititution mode for tests using locale of "ru"
- Closed