Jump to content

special characters


kurbsdude

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.