On 25 Jun, 17:20, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
On Jun 25, 5:15 pm, codefragm...@googlemail.com wrote:
* As the subject says, how do you know if a file is unicode, ascii or
whatever
You can't find out for sure. You can read some portion of it and check
for common patterns, but it's still only going to be a guess.
Is there no way that you can require files to be in a certain encoding
in your situation?
Jon
Hi
Thanks for the reply, I'm new to unicode in general.
- Can you have a file thats part unicode and part ascii or are they
one or the other?
- Once the file is read into c# is there anyway of checking the loaded
strings to see if their unicode?
- Anyone got some example code for checking the BOM?
I want to write a noddy program to read in a file that maybe ascii,
maybe unicode. If its unicode it will rewrite it
as ascii (fine so far) and tell you thats it did it. It could check
the file size which I guess should be halved
but I'm surprised theres no easier way of doing this?