How to convert from UTF-8 to ANSI using standard c++

后端 未结 4 797
孤街浪徒
孤街浪徒 2020-12-15 13:46

I have some strings read from the database, stored in a char* and in UTF-8 format (you know, \"á\" is encoded as 0xC3 0xA1). But, in order to write them to a file, I first n

4条回答
  •  有刺的猬
    2020-12-15 13:50

    If you mean ASCII, just discard any byte that has bit 7 set, this will remove all multibyte sequences. Note that you could create more advanced algorithms, like removing the accent from the "á", but that would require much more work.

提交回复
热议问题