C++ project type: unicode vs multi-byte; pros and cons

后端 未结 6 2022
栀梦
栀梦 2020-12-14 00:16

I\'m wondering what the Stack Overflow community thinks when it comes to creating a project (thinking primarily c++ here) with a unicode or a multi-byte character set.

6条回答
  •  -上瘾入骨i
    2020-12-14 00:56

    Are there pros to going Unicode straight from the start,

    A few years and a million lines of code later, you're going to wish you had answered "yes".

    implying all your strings will be in wide format?

    I wish Microsoft would quit conflating "Unicode" with UTF-16.

    You don't have to store all your strings in wide format. You can use UTF-8 instead, and get a smaller memory footprint (for Latin alphabet languages), and backwards compatibility with 7-bit ASCII.

    The one downside to using UTF-8 on Windows is that it's not supported as an ANSI code page, so you have to convert your strings to UTF-16 to make WinAPI calls. How much inconvenience this causes depends on whether you're writing a Windows program or a program that just happens to run on Windows.

提交回复
热议问题