-URL 인코딩 / 디코딩
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | var URL = { encode : function (str) { var result = ""; for(var i = 0; i < str.length; i++) { result += "%" + str.charCodeAt(i).toString(16).toUpperCase(); } return result; }, decode : function (str) { var result = ""; for(var i = 0; i < str.length; i++) { if ( str.charAt(i) == "%") { var data = "0x" + str.charAt(++i) + str.charAt(++i); data = parseInt(data, 16); result += String.fromCharCode(data); } } return result; } } | cs |
WRITTEN BY
,