How can find the text file encoded in other than ANSI format?
-
Hi all, i m trying to read a Text file using CStdioFile,but this is fail and read some garbage values whan the file is encoded with other than ANSI format like Unicode,UTF-8 etc. please tell me before start reading how can i identify the file is not in ANSI format. i m waiting for ur valuable suggestions. thanks in advance.
-
Hi all, i m trying to read a Text file using CStdioFile,but this is fail and read some garbage values whan the file is encoded with other than ANSI format like Unicode,UTF-8 etc. please tell me before start reading how can i identify the file is not in ANSI format. i m waiting for ur valuable suggestions. thanks in advance.
It depends, For some file formats there is no way to tell them apart programatically (e.g. Chinese Big5 vs. Ansi). I imagine you are more interested in unicode specifically, though. For Unicode files there is normally a BOM (byte order mark) at the beginning of the file which tells you what the file format is. Look up Byte order marks on wikipedia for a really good explanation. Alternatively if you don't want to do this by hand, read this article[^] for a CStdiofile derived class that auto-detects the encoding.
-
Hi all, i m trying to read a Text file using CStdioFile,but this is fail and read some garbage values whan the file is encoded with other than ANSI format like Unicode,UTF-8 etc. please tell me before start reading how can i identify the file is not in ANSI format. i m waiting for ur valuable suggestions. thanks in advance.