I'm working on an JavaEE application, which uploads text files to the server, to process their content. The user's text sources can vary greatly, especially their encoding.
I'd like to convert everything to UTF-8 (persistance is coming) but first, I'd need to read it correctly.
I'm using InputStreamReader's getEncoding() method :
public void doThings(HttpServletRequest request) {
Part file = request.getPart("formfile");
InputStreamReader isr = new InputStreamReader(file.getInputStream());
// BUT THIS ALWAYS prints "UTF8" whatever the text file's encoding is :
System.out.println( isr.getEncoding() );
}
I actually use InputStream because the app later uses Scanner class and delimiters to chop the data up, but if something else is the way to go, I'm not bound to it in any way...
Thanks for any pointers