Link to home
Start Free TrialLog in
Avatar of mnb93
mnb93

asked on

stripslashes(PHP) in javascript?

How can I do it?
Avatar of basicinstinct
basicinstinct
Flag of Australia image

I don't know PHP - in JavaScript there is an 'unescape' function...  Is that what you are after?
Avatar of mnb93
mnb93

ASKER

That's for urls.
I would like http://au.php.net/stripslashes

Returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\).

\' \" \n \r \c Really I would just like the \" and \\.
Avatar of mnb93

ASKER

eg. \\\\\\\"\"\\ = \\\""\
You'd have to use a very carefully crafted .replace() regular expression call.  A better option, though I'm not sure it would work, would be to use htmlentities() ( http://us3.php.net/manual/en/function.htmlentities.php ) instead of adding slashes to it in the first place.  Then the javascript unescape function would probably be able to translate it properly.  
ASKER CERTIFIED SOLUTION
Avatar of ClickCentric
ClickCentric

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