Skip to content

Instantly share code, notes, and snippets.

@aaei924
Created September 24, 2021 03:18
Show Gist options
  • Save aaei924/85b8e207a74f7e9424bfc91091f096e7 to your computer and use it in GitHub Desktop.
Save aaei924/85b8e207a74f7e9424bfc91091f096e7 to your computer and use it in GitHub Desktop.
GET 파라미터(URL Query String)를 EUC-KR로 인코딩하는 코드
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