更新时间:2023-11-06 23:33:22
一个冗长但可移植的方式是建立你的字符串数字转义码。例如:
A tedious but portable way is to build your strings using numeric escape codes. For example:
wchar_t *string = L"דונדארןמע";
变为:
wchar_t *string = "\x05d3\x05d5\x05e0\x05d3\x05d0\x05e8\x05df\x05de\x05e2";
您必须将所有的Unicode字符转换为数字转义。
You have to convert all your Unicode characters to numeric escapes. That way your source code becomes encoding-independent.
您可以使用在线工具进行转换,例如 this one 。它输出JavaScript转义格式 \uXXXX
,因此只需搜索&用 \x
替换 \u
以获取C格式。
You can use online tools for conversion, such as this one. It outputs the JavaScript escape format \uXXXX
, so just search & replace \u
with \x
to get the C format.