I need to be able to have PHP create a string which contains literal special characters such as Euro symbol, em dash, en dash, etc. -- NOT their html equivalents (e.g. € or ac; ).
Here's the complete situation. My user inputs text which might contain these special characters into an html form. The form is submitted to a PHP script via an AJAX call, so must be escaped using the Javascript escape() function. I use some simple PHP code to convert any special characters from the Javascript form %uXXXX to their html special character hex equivalents (e.g. AC; ). This would work great if all I needed to do was to echo the string to an html page, but what I really need to do is to write a TEXT file which contains the literal characters (not the html equivalents). So, how do I convert text like this: ac; to the literal characters?