I have some files generated from a script that provide information about various computers. The txt files are in UTF-8, however, there is one line that is in UTF-16 format. How should I go about reading this line from the file?
P.S. I'm trying to write a program to parse out all of these files and recompile them into one collective .csv file.
I have tried reading the file with a bufferedReader
and Scanner
, however this one line is the only one I am having trouble with. Most of the code I have found online for reading UTF-16 is for the entire file, which is not completely in UTF-16.
//How the line looks when opened in Notepad.
S e r i a l N u m b e r 5 C G 8 X X X X X X
//How the line looks when opened in Notepad++ with "nul" values in between each character.
S e r i a l N u m b e r 5 C G 8 X X X X X X
My code can pick up parts of the string, but the format of it is on multiple lines and Java doesn't recognize the characters in between each letter or number.