Issue with spanish characters in java string
I have issue with spanish characters in java string. I have a content in a file and when i try to transform it to java object using InputStreamReader, the output of some string i开发者_StackOverflow中文版s "cómo" which should be "cómo". This is happening other spanish like
á = á é = é í = à ó = ó ú = ú
and more..
Could you please help me to convert it appropriate output.
Thanks in advance
Have you tried to specify the character encoding in the constructor of InputStreamReader
, like so:
FileInputStream fis = new FileInputStream("file.txt");
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
Specify charset on your InputStreamReader - http://download.oracle.com/javase/1.5.0/docs/api/java/io/InputStreamReader.html#InputStreamReader(java.io.InputStream, java.lang.String)
精彩评论