How can I tell if a CSV is in UTF-7 or UTF-8
- by dru-zod
Excel seems to save CSV files in (what I think is) UTF-7, despite the fact that most information I have read suggest that in general, you should not UTF-7. Indeed, other applications (Text pad, which lets me choose) save things in UTF-8 (or Unicode etc, but UTF-7 is not even an option).
Using .NET, I read the stream, and have to provide the encoding. If I get it wrong, accented characters are replaced with question marks. If I try and let StreamReader work it out (using detectEncodingFromByteOrderMarks), it gets it wrong (at least, it does if the file has been saved in Excel).
It is unlikely that anything other then Excel will be used, so I could just assume UTF-7.
Are there any other options?
I need to support French (accented), German, Dutch, and Norwegian characters.