Recently, when working with files, the same type of files used may be different. So want to unify the format of the file (because of the universality of UTF-8, decided to UTF-8 Unified), met the first question is: How to view the existing file encoding method.
file Encoding Problem collection
The principle of string encoding (charset,encoding,decoding)
A brief analysis of Java coding
Method for determining file encoding or text stream encoding
Several of the articles above can be seen as "Getting started to mastering" in coding problems.
If you read the above article, it must be learned that in Java, the class file is encoded in UTF8, the JVM runs with UTF16. Java strings are always Unicode, using the UTF-16 encoding method.
Want to test, Java to UTF-8 file read and write ability, the results found a very depressed problem, if through Java write UTF-8 file, use Java can read correctly, but if you use Notepad to save the same content in UTF-8 format, The use of the program reads a non-visible character from the file.
Here are the reasons for describing the problem in detail, and the solution:
Http://www.cnblogs.com/luoyanli/archive/2013/04/12/3016139.html
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Java encoding UTF-8