Problem with spanish characters in java string

I have a problem with Spanish characters in a java string. I have the contents in the file, and when I try to convert it to a java object using InputStreamReader, the output of some line will be "cómo", which should be "cómo". This also happens with other Spanish, like

á = á é = à © í = à ó = ó ú = ú

and more..

Could you help me convert the corresponding result.

Thank you in advance

+4
source share
3 answers

You tried to specify the character encoding in the InputStreamReader constructor, for example:

 FileInputStream fis = new FileInputStream("file.txt"); InputStreamReader isr = new InputStreamReader(fis, "UTF-8"); 
+5
source

Can someone tell me, please, how to remove special characters. String entry = "$ 1 el minuto a 5 NÃmemeros Amigos"; and the output should be "$ 1 el minuto, 5 Números".

0
source

Source: https://habr.com/ru/post/1337868/


All Articles