Script URL:
Version of script: 2.41
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
Write your message below:
I want to pup up a suggest article list when admin input new ticket, I did this:
1. some js code to trigger autocomplete function on subject field
2. some php code to return related kb articles based on subject
3. load the article content to the msg body when admin select from the pop up suggest article list
It work well but some special characters show in the msg body, like &ldquo, &rdquo, it should be converted to double quotes " and ".
I tried using $txt=htmlspecialchars_decode($txt) but it can not work.
any suggestion?
thanks
convert &ldquo and &rdquo to double quotes
Moderator: mkoch227
-
- Posts: 94
- Joined: Wed Feb 29, 2012 2:00 am
convert &ldquo and &rdquo to double quotes
Eagle
Life is a journey.
Life is a journey.
Re: convert &ldquo and &rdquo to double quotes
&ldquo (“) and &rdquo (”) are variants on the (more simple) " ("), but they are both handled natively in HTML, so I believe htmlspecialchars_decode does not handle ldquo and rdquo as it assumes that they aren't escaped. html_entity_decode, on the other hand, does handle encoding and decoding “ and ”. So you have two options:
- Use html_entity_decode
- Replace “ and ” with just " and then use htmlspecialchars_decode
Mike, Lead Developer of
HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
-
- Posts: 94
- Joined: Wed Feb 29, 2012 2:00 am
Re: convert &ldquo and &rdquo to double quotes
hi, mkoch227
thanks for reply, but html_entity_decode can not work, it remove all the contents after subject ( I want article.subject + "==>" + article.content).
I made my customize suggest article php based on suggest_article.php, almost the same, the difference is my codes return Json data not echo the article content to the webpage.
The problem only happen for the SBC case quotes, all such characters input will be convert to &ldquo, &rdquo store in database, when pull it out and echo to the webpage, it will automatically display as double quotes correctly, but not for return json data.
any suggestion?
thanks for reply, but html_entity_decode can not work, it remove all the contents after subject ( I want article.subject + "==>" + article.content).
I made my customize suggest article php based on suggest_article.php, almost the same, the difference is my codes return Json data not echo the article content to the webpage.
The problem only happen for the SBC case quotes, all such characters input will be convert to &ldquo, &rdquo store in database, when pull it out and echo to the webpage, it will automatically display as double quotes correctly, but not for return json data.
any suggestion?
Eagle
Life is a journey.
Life is a journey.