js : var decode=decodeURIComponent(encoded.replace(//+/g, " ")); var encode=encodeURIComponent(decode);