Link to home
Start Free TrialLog in
Avatar of Frylock
Frylock

asked on

FCKeditor problem with value property that has quotes, apostrophes

I need the value property to be able to display content that has both single (apostrophe - ' ) and double qoutes - " ).  
 
What I am doing is echoing from php into value property content that includes both ' and ".  
 
However, the java gets escaped from with the ' or the " depending on which one I use to set the oFCKeditor.Value.  
 
' causes problems with  
oFCKeditor.Value = 'My ring's on my finger' ;  
 
The " causes problems with
oFCKeditor.Value = '<font size="2">hi</font>";  
 
Any help would be appreciated. I did a search and could not find any other answers to this.  
Avatar of dgelinas
dgelinas
Flag of United States of America image


oFCKeditor.Value = "My ring\'\s on my finger";  
oFCKeditor.Value = "<font size='2'>hi</font>";  
Avatar of archrajan
archrajan

try this
oFCKeditor.Value ="My ring's on my finger";  

oFCKeditor.Value = '<font size="2">hi</font>';  
Avatar of Frylock

ASKER

Hi,

The problem is that the value property is being pulled from a db and is being echoed. EG:

The var_text = <font="2">My Mom's ring is in the box.</font>

Now, when I echo that into the value this way:

oFCKeditor.Value = "<? echo $var_text ; ?>" ;

The server sends:

oFCKeditor.Value = "<font="2">My Mom's ring is in the box.</font>";

Swapping the " for a ' doesn't help because both are used in the string.
thanks
ASKER CERTIFIED SOLUTION
Avatar of virmaior
virmaior
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Frylock

ASKER


I put in the 'addslashes' to the echo'd variable, but it is still tripping up on it.

Here is what the source of the page shows:

oFCKeditor.Value = '<p>He said to the woman, &quot;Who is your favorite singer?&quot;</p><p>She responded, after looking at her mother\'s watch, &quot;Shirley Manson\'s voice is spectacular.&quot; </p>' ;

It is still being broken.


Avatar of Frylock

ASKER

HEy Virmajor - it's the line break that is killing it now.There are two or three of them and the line breaks kill it. How can I get rid of them?
str_replace("\n",'\n',$yourstring)

alternately: str_replace("\n",'<br />',$youstring);
 
(the former will cause JavaScript to reinterpolate the line breaks, the latter will cause the same effective appearance).