How To Convert Unicode Strings to Lower Case and Upper Case in C++ -- Giovanni Dicanio

Converting Unicode strings to lower and upper cases should be an easy task to accomplish. Unfortunately, that is not the case with C++. Even the so common approach of iterating "char-by-char" in the input string and invoking std::tolower/toupper is wrong. Let's discuss a possible solution to this problem in this article:

How To Convert Unicode Strings to Lower and Upper Case in C++

by Giovanni Dicanio

From the article:

[...] A possible solution to properly convert Unicode strings to lower and upper cases in Windows C++ code is to use the LCMapStringEx Windows API. This is a low-level C interface API.

I wrapped it in higher-level convenient reusable C++ code, available here on GitHub. I organized that code as a header-only library: you can simply include the library header, and invoke the ToStringLower and ToStringUpper helper functions.

 

Add a Comment

You must sign in or register to add a comment.

Comments (0)

There are currently no comments on this entry.