Err Posted April 9, 2012 Share Posted April 9, 2012 I'm dealing with a replacement character inside a database... and it's fine if it stays there but I'm trying to edit it. My form displays the character as a diamond shape with a question mark in it (�). So I submit the form, I compare the data between the one on the form to the on in the data to see if it has changed. The problem here is that when I submit the form it turns the replacement character into & #65533; which is the html entity equivalent so when this happens it fails the comparison and the code thinks the string has changed-- which it has, but not really. I've tried to employ different methods of either turning the replacement character into the html entity equivalent from the database when it's being compared --it starts to turn another seemingly normal characters into other replacement character html entities equivalent (through no fault of my own)-- and turning the html entities into the replacement character --which doesn't work-- but they both fail. My questions is: How can I keep the character from turning into an html entity? Link to comment Share on other sites More sharing options...
Don E Posted April 9, 2012 Share Posted April 9, 2012 Have you tried the htmlspecialchars_decode() and/or html_entity_decode() functions? http://www.php.net/manual/en/function.htmlspecialchars-decode.phphttp://www.php.net/manual/en/function.html-entity-decode.php Link to comment Share on other sites More sharing options...
Err Posted April 9, 2012 Author Share Posted April 9, 2012 Yes, both. In fact, I originally started with those two but I've been at this for so long that I forgot to mention it. Link to comment Share on other sites More sharing options...
birbal Posted April 9, 2012 Share Posted April 9, 2012 first make sure database table/column collation ,mysql connection collation is utf-8, your page content type encoding ,your page's encoding is in utf-8. Link to comment Share on other sites More sharing options...
Err Posted April 9, 2012 Author Share Posted April 9, 2012 Yes. I've made sure of that. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.