Problem displaying SINGLE and DOUBLE quotes

Here is the scenario:
An SQL query is performed and a result is returned. In this result, there is a column which contains text that has single quotes, double quotes, and hyphens (-). None of these characters display properly when echo’ed (show up as weird symbols).
I have tried numerous PHP functions, such as htmlentities, html_entity_decode, and htmlspecialchars_decode. I have tried these functions with parameters ENT_QUOTES and ‘UTF-8’, still no luck. Not sure what else I could try to solve this issue, which appears to be dealing with encoding.

Any input would be appreciated.

Standard ASCII symbols like single/double quotes and hyphens are always displayed properly. In your case there must be non-standard symbols like left/right quotes, and other non-ascii symbols. Encoding them (with the functions you mentioned) should normally work. Did you check your database charset? Also, do you have proper charset set on the html page where you outputting your query result? I would try UTF-8 or Latin 1 (Windows-1252):

[code]

[/code]

Thanks for the response.
I do have that exact line in the head of the page that I am displaying the results. It had UTF-8 and I experimented with Latin 1, still did not work(just changed the symbols to different symbols).

I believe you are correct, I think the text contains left/right quotes. Is there a single PHP function that would handle this encoding in one shot?

Sponsor our Newsletter | Privacy Policy | Terms of Service