Text file got encoded in UTF16. (VC2005)
-
I'm using Visual Studio Express. I tried to output some data into a text file, I found that the file is encoded in UTF16. The wired part is that non-ASCII characters are in MultiByte encoding (all of them takes two bytes), but the ASCII ones got in UTF16 (which also takes two bytes), and the whole file has a UTF16 BOM. The file is opened with
fopen
, and written withfprintf
. My strings in my program all all unicode strings, so I had to write like this:fprintf(" "); fprintf("%ls", L"UNICODE STRING");
There is some non-ASCII characters in my unicode strings. I used wide-char version functions in my program explictly, except for file operations (I didn't use wfprintf or wfopen). The charset for the project is set to "No set", and neitherUNICODE
norMBCS
is defined. I have set the locale at the begin of main. And I want to get a MultiByte file, how can get it? Thanks in advance.