View Full Version : Getting special characters to work in form fields?

09-06-2007, 12:23 AM
//When just using a textarea, I'm not setting a value, so alls good...
$details = stripslashes($row[details]);

//When set via value, I get an accented before a Registered Trademark symbol.
$blurb = "value=\"" . stripslashes($row[blurb]) . "\"";

How do you get special characters to stop generating all sorts of crazy stuff when being set to input fields?

<p><label for=\"description\">Description<small>(HTML Enabled)</small>: </label><textarea cols=\"45\" rows=\"8\" name=\"details\">$details</textarea></p>
<p><label for=\"blurb\">Blurb<small>(Example)</small>: </label> <input type=\"text\" name=\"blurb\" size=\"40\" maxlength=\"64\" $blurb /></p>

09-06-2007, 12:27 AM
Check your character encoding (UTF-8 vs. ???) because usually those characters are generated by improperly using text from a different encoding. Such as using substr() on a multibyte string (UTF-8, etc.). Substr() doesn't know that some characters are composed of 2 bytes, so they treat it as a normal character, which is why you see the odd A.