简体   繁体   中英

How can I remove the BOM from a UTF-16 LE file in C++?

I have a UTF-16 LE file and at the beginning it has a BOM.

How do I remove this using C++? I've seen many Python examples.

Ultimately I would like it to be a UTF-8.

How can I remove the BOM from a UTF-16 LE file in C++?

The size of UTF-16 BOM is 2 bytes. You can remove the BOM by copying all bytes except the first two that contain the BOM into a new file. Replace the old file with the new.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM