I am using C#, I have a comma delimited csv file with different strings in different languages.
My app should only open the CSV if it’s unicode.
Is there an easy way to determine this in code ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you say “Unicode” I assume you mean UTF-8. Unicode is not an encoding and a file can’t be “Unicode”.
You could use a library, for example, ude is a C# library that attempts to determine what encoding a file uses. It uses the algorithm described here. It is not 100% foolproof.