简体   繁体   中英

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 is "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");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM