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)
======================================================================