New UTF-8 features in Windows 10 1903

UTF-8 everywhere just got a whole lot easier in Windows 10 1903.
Two big additions:
1) UTF-8 codepage per process (previously was only available in control panel region-administrative as a Beta feature and affected all processes)
This is the new ActiveCodePage manifest value (works for regular Win32 x86 and x64 apps)
This means you can make a UTF-8 app with UTF-8 code page that doesn’t rely on any system locale setting. That along with some C Runtime library changes for UTF-8 locale in some recent Windows 10 SDKs will help you write apps in UTF-8.
2) If you get the charset of the UTF-8 code page it returns something new under Windows 10 1903!
BYTE GetUTF8Charset()
    DWORD  dwCodePage;
    dwCodePage = 65001;
    if (TranslateCharsetInfo((DWORD *)(ULONG_PTR)dwCodePage, &cs, TCI_SRCCODEPAGE))
        return (BYTE)cs.ciCharset;
        return DEFAULT_CHARSET;
Check the value of cs.ciCharset , it is a special value, 254.  This is undocumented, and works differently than DEFAULT_CHARSET.
If you use this charset in a font (lfCharSet), and select the font into the DC, then GDI functions will use that code page to convert from A to W.  That means you can call functions such as ExtTextOutA, DrawTextA etc, with UTF-8 strings and they will just convert correctly to UTF-16. Length passed in should be in bytes.
Note: this only returns 254 in Windows 10 1903 or higher and is not even tied to the UTF-8 code page in (1). Can be used any time.

About tedwvc
On this blog you'll find some tips and tricks for dealing with Visual C++ issues.

2 Responses to New UTF-8 features in Windows 10 1903

  1. ymjia90 says:

    Could you please tell me how to apply code page through manifest offline? According to the link your mentioned, I use Fusion manifest xml , It works, but request a page from, if no internet connection available, I cannot set code page for process any more.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: