Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I convert a UTF-8 string to upper case?

Tags:

c

utf-8

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?

like image 590
August Karlstrom Avatar asked Mar 29 '12 16:03

August Karlstrom


People also ask

How do I convert a character to a string uppercase?

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.

What is the function to convert a character a into upper case?

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.

Which string function converts the value in upper case?

The toUpperCase() method returns the value of the string converted to uppercase.


2 Answers

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.

like image 148
Praetorian Avatar answered Nov 02 '22 04:11

Praetorian


glib has g_utf8_strup().

like image 40
Ignacio Vazquez-Abrams Avatar answered Nov 02 '22 04:11

Ignacio Vazquez-Abrams