How to remove any BOM from UTF-8 encoded text files
EDIT: Solved with Apache Commons IO BOMInputStream
I have some text files starting with
And the reading function
MyData = new BufferedReader(new InputStreamReader(new FileInputStream(inFile), Encoding));
When the file is encoded with no BOM it's read perfectly, but when contains BOM the line produces something like
How can I detect the several encodings and remove them from the stream?