The code is the following:

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

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

Any thoughts?

有帮助吗?

解决方案

You want to use mb_strtoupper() instead:

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

Output:

HELLO! ПРИВЕТ!

Demo

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top