- using string php string

I searched but still a dead end

How to convert a string with ñ to have - uppercase too?

eg.

"Nuñez"

to

"NUÑEZ"

mb_strtoupper not working due to lack of english.

-6
source share
1 answer

You will need to play with encoding.

$content = 'Nuñez';

mb_internal_encoding('UTF-8');
if(!mb_check_encoding($content, 'UTF-8')
OR !($content === mb_convert_encoding(mb_convert_encoding($content, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {

$content = mb_convert_encoding($content, 'UTF-8'); 
}

// NUÑEZ
echo mb_convert_case($content, MB_CASE_UPPER, "UTF-8"); 

via PHP: mb_strtoupper does not work

+2
source

All Articles