Question

The code is the following:

setlocale( LC_CTYPE, 'ru_RU' );
echo strtoupper('Hello! Привет!');

Latin characters transforming as expected. But Russian - stays unchanged.

Any thoughts?

Was it helpful?

Solution

You want to use mb_strtoupper() instead:

mb_internal_encoding('UTF-8');
setlocale(LC_CTYPE, 'ru_RU');
echo mb_strtoupper('Hello! Привет!');

Output:

HELLO! ПРИВЕТ!

Demo

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top