
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
