UTF-8 encoding with internet explorer% u20AC to & euro;
I am currently using TinyMCE as my html editor for my CMS users. One way or another, the euro symbol (€) is converted to% u20AC IE (any).
After a short search, I found this . This gives a lot for different encodings for the Euro UTF-8 character, but not% u20AC, with a percent icon.
I gave the correct headers for UTF-8, so I believe IE is just crudely doing things in its own way ...
Is there a PHP function that can catch this weird encoding and put it in a normal htmlentity (hex, decimal or named). I could just have string_replace()
this single symbol of the problem, but I would rather fix all possible conflicts at once.
Or should I just replace %u
with &#x
, disabling the normal use of% u?
source to share
%u20AC
- data in Unicode encoding for €
, which is generated by the JavaScript function escape()
for UTF8 for server-side processing.
The standard PHP urldecode can't handle this, so you need to use an extended procedure:
/**
* @param string $str unicode and ulrencoded string
* @return string decoded string
*/
function utf8_urldecode($str) {
$str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
return html_entity_decode($str,null,'UTF-8');;
}
Also check if you can customize this behavior for your TinyMCE.
source to share