Your problem is that strtoupper
will destroy your UTF-8 entity-decoded input because it is not multibyte aware. In this instance, ’
decodes to the hex-encoded UTF-8 sequence e2 80 99
. But in strtoupper
's single-byte world, the character with code \xe2
is â
, which is converted to Â
(\xc2
) -- which makes your text an invalid UTF-8 sequence.
Simply use mb_strtoupper
instead.