kurbsdude Posted September 18, 2009 Share Posted September 18, 2009 I have a textarea that can contain both unicode characters and umlauts. Using $_GET, I get the textarea value and save it to $string Then I use htmlentities($string) and save this to a database. Now I want to read this value and display it. But the html_entity_decode simply won't display both types of characters properly. When one type displays properly, other type result to a ���� Please let me know if there's a solution to this, thanks. Link to comment https://forums.phpfreaks.com/topic/174707-special-characters/ Share on other sites More sharing options...
Bricktop Posted September 18, 2009 Share Posted September 18, 2009 Hi kurbsdude, Have you tried passing the correct character set to the htmlentities function? http://us2.php.net/htmlentities/ Something like: htmlentities($string, ENT_COMPAT, "ISO8859-1"); and: html_entity_decode($string, ENT_COMPAT, "ISO8859-1"); Hope this helps. Link to comment https://forums.phpfreaks.com/topic/174707-special-characters/#findComment-920724 Share on other sites More sharing options...
kurbsdude Posted September 18, 2009 Author Share Posted September 18, 2009 Thanks Bricktop but it didn't work... ok here's what happens suppose $string is: öå . ’ “ दि what i've done is 1. htmlentities($string); or htmlentities($string, ENT_COMPAT, "UTF-8"); 2. saved to database Now if I do not use html_entity_decode or use a simple html_entity_decode(); öå displays correctly but other characters display codes (example %u2019) If I use html_entity_decode($string, ENT_COMPAT, "UTF-8"); I get all weird characters Seems like there's double htmlentities() in action Any suggestions? Link to comment https://forums.phpfreaks.com/topic/174707-special-characters/#findComment-920767 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.