Any idea about gettin the real encoding of a file like .html .txt .java and etc in java?
Since some source codes are not utf-8,I wantto change them to utf-8.
In general, it is not possible to always detect exactly what the character encoding of a text file is - there's nothing stored in a text file that tells you explicitly what the character encoding is. You can make some intelligent guesses, but don't expect that you'll always be able to find out exactly what the character encoding of a text file is.
The link that cebewee posted in the comments has more information on how to detect what the character encoding of a text file is.
You can use tools like UTFCast to batch convert file encoding. Just run them on all of your source files and you should be done. On linux, you can use 'iconv' to convert file encoding.
精彩评论