Created
September 24, 2021 03:18
-
-
Save aaei924/85b8e207a74f7e9424bfc91091f096e7 to your computer and use it in GitHub Desktop.
GET 파라미터(URL Query String)를 EUC-KR로 인코딩하는 코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const iconv = require('iconv-lite') | |
const euckr_urlencode = (str) => { | |
var buf = iconv.encode(str, "euc-kr"); | |
var encodeStr = ''; | |
for (var i = 0; i < buf.length; i++) { | |
encodeStr += '%' + buf[i].toString('16'); | |
} | |
return encodeStr.toUpperCase(); | |
} | |
module.exports = euckr_urlencode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment