Java in Chinese linux system folder appears Chinese garbled problem

  
                  

Description of the problem: The default character encoding of linux is utf-8, which is a file with Chinese name stored on linux, but it is garbled with java readout, all? ? ? ? ? ? Then I pass: new String(files[i].getName().getBytes("GB2312"),"UTF-8"); This way, the Chinese file name becomes all?????, should How to transcode to get Chinese?

Answer to the question: The character encoding in Java defaults to Unicode

with new String(files[i].getName().getBytes("UTF-8"),"UTF- 8"); Try it to help me

Upload in utf8 format, then download it in utf8 format, but the server is garbled, and the traversal is Chinese.

Copyright © Windows knowledge All Rights Reserved