How to set file encoding format to UTF8 in C++

后端 未结 4 963
慢半拍i
慢半拍i 2021-01-13 03:59

A requirement for my software is that the encoding of a file which contains exported data shall be UTF8. But when I write the data to the file the encoding is always ANSI. (

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-13 04:16

    On Windows, files don't have encodings. Each application will assume an encoding based on its own rules. The best you can do is put a byte-order mark at the front of the file and hope it's recognized.

提交回复
热议问题