-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.1.6
-
generic
-
generic
Name: tb29552 Date: 06/30/98
There is a bug in java.lang.Properties with Korean string.
load() method is not handle korean string.
The test code is below.
import java.io.*;
import java.util.*;
public class PropertiesTest
{
public static void main(String[] args) throws Exception
{
Properties p=new Properties();
p.load(new FileInputStream("test.properties"));
System.out.println(p.getProperty("a"));
System.out.println(p.getProperty("b"));
System.out.println(p.getProperty("ÇÑ"));
}
}
test.properties contains :
a=java
b=ÇѱÛ
ÇÑ=ÀÚ¹Ù
Expected result is
java
ÇѱÛ
ÀÚ¹Ù
But, the output is
java
??¡¾?
null
Java is the language based on Unicode.
but, this result is not apply this policy.
The troublesome solution is using additional code.
String koreanString=new String(p.getProperties("b").getBytes("8859_1"), "KSC5601");
But, this solution can't correct the problem that not recognize
unicode key in Properties.
I want to use Korean string in Properties directly.
If JavaSoft overload load() method like follow, may correct this problem.
public void load(InputStream);
public void load(Reader);
Thanks for reading.
This works fine when reading english or number...
but, not convert input characters to korean string correctly.
Is it design mistake in Java I18N?
Why can't i manipulate Korean string with Properties class directly?
(Review ID: 33206)
======================================================================
There is a bug in java.lang.Properties with Korean string.
load() method is not handle korean string.
The test code is below.
import java.io.*;
import java.util.*;
public class PropertiesTest
{
public static void main(String[] args) throws Exception
{
Properties p=new Properties();
p.load(new FileInputStream("test.properties"));
System.out.println(p.getProperty("a"));
System.out.println(p.getProperty("b"));
System.out.println(p.getProperty("ÇÑ"));
}
}
test.properties contains :
a=java
b=ÇѱÛ
ÇÑ=ÀÚ¹Ù
Expected result is
java
ÇѱÛ
ÀÚ¹Ù
But, the output is
java
??¡¾?
null
Java is the language based on Unicode.
but, this result is not apply this policy.
The troublesome solution is using additional code.
String koreanString=new String(p.getProperties("b").getBytes("8859_1"), "KSC5601");
But, this solution can't correct the problem that not recognize
unicode key in Properties.
I want to use Korean string in Properties directly.
If JavaSoft overload load() method like follow, may correct this problem.
public void load(InputStream);
public void load(Reader);
Thanks for reading.
This works fine when reading english or number...
but, not convert input characters to korean string correctly.
Is it design mistake in Java I18N?
Why can't i manipulate Korean string with Properties class directly?
(Review ID: 33206)
======================================================================
- relates to
-
JDK-4035543 Properties.load() doesn't work correctly against multi-byte character strings.
-
- Closed
-