If there is a legal + in the string, it will already be encoded as %2B . Therefore, before calling decodeURIComponent() in a string, replace all + that represent a space in the string by space, and then call decodeURIComponent() to decode the string.
Use this code
var str = "%4Bseri%2Balized+String+plus" str = str.replace(/\+/g, " "); str = decodeURIComponent(str); alert(str);
Demo
source share