function betterDecodeURIComponent(s) { if (s == null) return ''; s = s.replace(/\+/g, '%20'); s = decodeURIComponent(s) return s; } function betterEncodeURIComponent(s) { if (s == null) return ''; s = encodeURIComponent(s); s = s.replace(/%20/g, '+'); return s; }
Programming Tips - javaScript: encode/decodeURIComponent() don't deal with +
Date: 2019may14
Language: javaScript
Keywords: plus
Q. javaScript: encode/decodeURIComponent() don't deal with +
A. Here are better versions of those functions