Follow up on this post I made earlier on.
I found out XML actually takes numeric codes instead of name codes when dealing with special characters. So I have looked through online on how to convert special characters into numberic codes, but I haven’t got any lucks.
Do I have to write a function to do this task or does php come with any default function which can save up lots of works?
For instance, I want to convert á to á but not á to á
Is it possible?
Please help if you have any ideas.
EDIT:
I am using this suggestion to convert the special chars into numberic chars,
$txt = preg_replace('/([\x80-\xff])/e', "'&#' . ord('$1') . ';'", $txt);
but I just found out that it does not convert these 5 special chars into numberic codes – <, >, &, ' and ".
How can I get around them?
Thanks.
The generic approach is to use:
You must ensure that $txt does indeed contain Latin-1 already (
utf8_decode), because you’d otherwise receive the wrong value from the string byte.