C++: how to convert ASCII or ANSI to UTF8 and stores in std::string

前端 未结 2 1480
庸人自扰
庸人自扰 2021-02-06 18:03

My company use some code like this:

    std::string(CT2CA(some_CString)).c_str()

which I believe it converts a Unicode string (whose type is CS

2条回答
  •  一整个雨季
    2021-02-06 18:56

    Becareful : it's '|' and not '&' !

    *buffer++ = 0xC0 | (c >> 6);
    *buffer++ = 0x80 | (c & 0x3F);
    

提交回复
热议问题