Windows API: ANSI and Wide-Character Strings — Is it UTF8 or ASCII? UTF-16 or UCS-2 LE?

前端 未结 4 1576
深忆病人
深忆病人 2020-12-23 09:58

I\'m not quite pro with encodings, but here\'s what I think I know (though it may be wrong):

  1. ASCII is a 7-bit, fixed-length encoding, with the characters you c
4条回答
  •  北海茫月
    2020-12-23 10:25

    1. *A functions used the active ANSI codepage.

    2. *W function use UTF-16.

    3. Multi-byte refers to whatever is passed in the CodePage parameter. It is most commonly either the active ANSI codepage or UTF-8.

    4. LPWSTR is a UTF-16 string which may or may not be null-terminated (see MSDN)

    5. I don't know anything about wcstombs, I always use WideCharToMultiByte.

    6. File paths are in UTF-16. In fact all text is UTF-16 internally in Windows.

    7. For ANSI encoding you will need to read up on that in some detail. You could do worse than to start with Wikipedia and follow the links from there.

    I hope that helps and that if I've got anything wrong, anyone who knows more please do edit this to correct any errors!

提交回复
热议问题