title: Is there a way to find file encoding type (UTF-8 or ANSI or Cp1252 or others) using java
body: <p>I have to read few html files. If i use UTF-8 as charset for reading and writing a file, there are some junk characters getting displayed in html page. It seems the actual file is ANSI encoded since i am using UTF-8 for reading and writing the file, few white spaces are displayed as black diamond with question mark.</p>
  <p>Is there a way to find the encoding/charset to be used to read/write a particular file?</p>