0

I am following the sample code at http://codewee.com/view.php?idx=101 to write data in UTF-16LE encoding, that is, ccs=UTF-16LE

I find the file created in this way will always contain a BOM(0xFEFF).

That is OK for a single file.

However, currently I need to generate several UTF-16LE files and merge them into one file. Therefore, only one BOM at the beginning of the first file is enough, while the BOMs in the remaining files are useless.

Therefore, is there a way to prevent _tfopen_s or CStidoFile from writing the BOM for some specific files?

alancc
  • 487
  • 2
  • 24
  • 68
  • You can possibly try opening/writing the files in *binary* mode, as suggested here: [Is it possible to prevent adding BOM to output UTF-8 file?](https://stackoverflow.com/a/36253407/10871073) – Adrian Mole Dec 26 '19 at 03:33
  • 2
    There's something wrong with the merging code that we can't see. Seems it reads binary data instead of text from the files. Clearly that is the wrong way to do it. – Hans Passant Dec 26 '19 at 13:03

0 Answers0