Skip to content
Showcases how to use UTF-8 in C++ with the win32 api
C++ CMake
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CMakeLists.txt
README.md
main.cpp
manifest.xml
screen.png

README.md

UTF-8 Programs on windows

This project showcases how to support UTF-8 in windows applications. By using UTF-8 everywhere, you guarantee your application will be portable accross platforms.

screenshot

⚠️ UTF-8 support on windows is still fairly bleeding edge and requires a very recent of windows that is not widely deployed yet.

Requirements

Steps

  • In the main of your application configure the console to expect UTF-8
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
  • Link the provided manifest to enable UTF-8 as the active code page
  • Compile your source files with the /utf-8 option. Make sure your source files are utf8-encoded.
  • Use the ANSI system APIs (functions suffixed with A, like CreateFileA) with utf-8 encoded string parameters (confusing, isn't it)
You can’t perform that action at this time.