Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
BhavikaW
Contributor III
Contributor III

Check the encoding of text file

Hello,

I need to check the encoding of text file that whether it is UTF 8 with BOM or UTF 8 without BOM or ANSI and further proceed based upon the result.

I could not find the code to check for UTF without BOM or ANSi encoding. can anyone please help with this issue. I am using tchangefileencoding to convert the textfile but before that i need to detect the encoding.

 

Regards,

BhavikaW

 

Labels (2)
1 Reply
Anonymous
Not applicable

Hi
I search and find some third party library can used to check the encoding, such as ICU4J, refer to the discussions on stackoverflow.
https://stackoverflow.com/questions/499010/java-how-to-determine-the-correct-charset-encoding-of-a-s...
https://stackoverflow.com/questions/3684530/how-to-detect-the-character-encoding-of-a-file

In Talend job, you can use a tJava or write a user routine to hard code to detect the encoding. You may try it!

Regards
Shong