Have an upload process, reads the file and using sqlldr it uploads the data to DB. I was getting invalid number issue while processing the file in sqlldr. Found the file is in UTF-16 format and then converted to UTF-8 format in notepad++, it started working fine. Now i am trying to convert it systematically like below.
iconv -f UTF-16 -t UTF-8 file_name >output_file_name
The file may be of different encodings, so i want to find what encoding the file is of, before converting and then based on that do conversion. something like use file command to read the UTF-16 only from the below and then use it in the -f option.
bash-4.2$ file "/FILE_UPLOADS/Relationship (4).txt"
/FILE_UPLOADS/Relationship (4).txt: Little-endian UTF-16 Unicode text, with CRLF line terminators
How do I do that?
bash
? – Stéphane Chazelas Sep 12 '22 at 13:42file
for the detection? – Toby Speight Sep 13 '22 at 07:51