?
Solved

stripslashes(PHP) in javascript?

Posted on 2006-05-27
7
Medium Priority
?
1,020 Views
Last Modified: 2008-02-01
How can I do it?
0
Comment
Question by:mnb93
  • 2
  • 2
5 Comments
 
LVL 23

Expert Comment

by:basicinstinct
ID: 16774962
I don't know PHP - in JavaScript there is an 'unescape' function...  Is that what you are after?
0
 
LVL 5

Author Comment

by:mnb93
ID: 16774978
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 \\.
0
 
LVL 5

Author Comment

by:mnb93
ID: 16774979
eg. \\\\\\\"\"\\ = \\\""\
0
 
LVL 10

Expert Comment

by:ClickCentric
ID: 16776606
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.  
0
 
LVL 10

Accepted Solution

by:
ClickCentric earned 1000 total points
ID: 16776610
No, wait...I'm not thinking clearly.  Not htmlentities(), use urlencode() ( http://us3.php.net/manual/en/function.urlencode.php )
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question