Reading UTF-8
HI, I need read properties file of different lang.
when i try to run following code , i am not getting proper value .
Thanks in advance
import java.io.*;
import java.lang.*;
import java.util.*;
publicclass check{
/**
* @param args
*/
publicstaticvoid main(String[] args){
// TODO Auto-generated method stub
try{
BufferedReader in =new BufferedReader(new InputStreamReader(new FileInputStream("es.properties"),"UTF-8"));
String line =null;//not declared within while loop
System.out.println(System.getProperty("file.encoding"));
Properties pi = System.getProperties();
pi.put ("file.encoding","UTF-8");// To add a new one
System.setProperties(pi);
System.out.println(System.getProperty("file.encoding"));
while (( line = in.readLine()) !=null){
String str = in.readLine();
//byte[] transbyte = str.toString().getBytes("UTF-8");
//String fieldStringValue2 = new String(transbyte, "UTF-8");
String UTF8Str =new String(str.getBytes(),"UTF-8");
System.out.println(UTF8Str);
}
}catch (UnsupportedEncodingException e)
{
System.out.println("unsupport"+e.getMessage());
}
catch (IOException e){
System.out.print("Io"+e.getMessage());
}
}
}

