- mb_convert_encoding: documentation ( source)
- mb_check_encoding: documentation ( source)
- strtoupper: documentation ( source)
<?php
$content = 'Le Courrier de Sáint-Hyácinthe';
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');
}
echo strtoupper($content);