Is there a portable way to convert a UTF-8 string in C to upper case? If not, what is the Linux way to do it?
Performing the . upper() method on a string converts all of the characters to uppercase, whereas the lower() method converts all of the characters to lowercase.
The toupper() function changes the lowercase alphabets to uppercase alphabets. Here is an example where we use toupper() for lowercase alphabets. Explanation: As the input string contains lowercase characters, the output string contains the converted uppercase of all the characters.
The toUpperCase() method returns the value of the string converted to uppercase.
The portable way of doing it would be to use a Unicode aware library such as ICU. Seems like u_strToUpper
might the function you're looking for.
glib has g_utf8_strup()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With