how to detect the encoding of the file with Java?
I need to import a file which may hava a utf-8, Unicode or ANSI or some any other kind of encoding.
The code which I am using to read the file as follows
BufferedReader reader =
new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
Since I am using the UTF-8 as the default encoding to read the file, in case the file has some other encodings , I am unable to dispaly the contents properly on my jsp after having been imported.
I am importing a file which has extended characters and special characters as its content
Please anybody suggest a code for the same to handle different encodings of the file