如何获取 UWP 中当前使用的代码页?

How do I get the currently used code page in UWP?

我想知道当前使用的是哪个字符集。我正在使用 c++/winrt 构建 UWP 应用程序。

提前致谢

通用 Windows 平台 (UWP) 应用程序通常使用 Unicode。一些 "A" 版本的函数(如 CreateEventACreateMutexAOutputDebugStringA 等)可用,因为这些字符串是纯内部的,没有本地化。

建议在启用 UNICODE_UNICODE 的情况下构建,使用 W 版本的 Win32 APIs,并使用 TCHAR 和无效所有多字节 C/C++ 运行时函数。

也就是说,Windows 10 SDK 的最新版本已将更多 ASCII 函数添加回 UWP API 分区以支持更多第 3 方库。支持GetACP

This was not supported in the Windows 10 Anniversary Update SDK (14393) which was the last Windows 10 SDK to officially support VS 2015, but if you are using VS 2017 or later with a newer Windows 10 SDK you should have it defined for the WINAPI_FAMILY_PARTITION for WINAPI_FAMILY_APP in winnls.h.