Java App : Unable to read iso-8859-1 encoded file correctly

后端 未结 5 877
一个人的身影
一个人的身影 2020-12-16 04:27

I have a file which is encoded as iso-8859-1, and contains characters such as ô .

I am reading this file with java code, something like:

File in = n         


        
5条回答
  •  长情又很酷
    2020-12-16 05:08

    If you can, try to run your program in debugger to see what's inside your 's' string after it is created. It is possible that it has correct content, but output is garbled after System.out.println(s) call. In that case, there is probably mismatch between what Java thinks is encoding of your output and character encoding of your terminal/console on Linux.

提交回复
热议问题