This is the reversal part of my previous post Convert string to special characters you want using replace() function in javascript. Useful when converting characters to be saved in the database or passed as a parameter in a url. function convertSC(oldstring){ oldstring = oldstring.replace(/_DQ_/g, “””); oldstring = oldstring.replace(/_SQ_/g, “‘”); oldstring = oldstring.replace(/_@_/g, “&”); oldstring = [...]
Archive for the ‘Javascript’ Category
Javascript: How to String/Characters to any special characters using javascript
June 25th, 2009
Jervie David Montejar Javascript : How to convert special characters to any string
May 15th, 2009
Jervie David Montejar Convert special characters to any string you want using replace() function in javascript. Useful when converting characters to be saved in the database or passed as a parameter in a url. function convertSC(oldstring){ newstring = oldstring.replace(/”/g, “_DQ_”); //double quote newstring = newstring.replace(/’/g, “_SQ_”); //apostrophe newstring = newstring.replace(/&/g, “_@_”); //ampersand newstring = newstring.replace(/%/g, “_PC_”); //percentage return [...]





Posted in

