E9 is 233 in decimal. This is not a valid ASCII byte (only 0-127), but it is é in ISO-8859-1 (Latin1). When using mb_convert_encoding you can specify several encodings (for example: UTF-8 and ISO-8859-1).
This should fix:
mb_convert_encoding($str, 'UTF-8', 'UTF-8,ISO-8859-1');
With the following script:
$str1 = 'Documents%20partag%E9s'; $str2 = 'Documents%20partag%C3%A9s'; var_dump(mb_convert_encoding(urldecode($str1), 'UTF-8', 'UTF-8,ISO-8859-1')); var_dump(mb_convert_encoding(urldecode($str2), 'UTF-8', 'UTF-8,ISO-8859-1'));
I get:
string(19) "Documents partagés" string(19) "Documents partagés"
source share