tags:

views:

205

answers:

3

I am using tinyMCE and, rather annoyingly, it replaces all of my apostrophes with their HTML numeric equivalent. Now most of the time this isn't a problem but for some reason I am having a problem storing the apostrophe replacement. So i have to search through the string and replace them all. Any help would be much appreciated

+8  A: 

did you try:

$string = str_replace("&#39;", "<replacement>", $string);
Owen
The very trick straight off. Thankyou very much!
Drew
+1  A: 

Is it just apostrophes that you want decoded from HTML entities, or everything?

print html_entity_decode("Hello, that&#39;s an apostophe.", ENT_QUOTE);

will print

Hello, that's an apostrophe.
RJHunter
+1  A: 

Why work around the problem when you can fix the cause? You can just turn of the TinyMCE entity encoding*. More info: here

*Unless you want all the other characters encoded, that is.

Vincent Van Den Berghe
Cheers! Unfortunately i need to leave it on so flash can read all the other characters properly.
Drew