반응형
m.logPrint() is working!
<eq> and <eqq> tags are rendered to MathJax format, being enclosed by \ ( \ ) and \ [ \ ].
docuK1 scripts started!
If this log is not closed automatically, there must be an error somewhere in your document or scripts.
Table of Contents is filled out.
Auto numberings of sections (div.sec>h2, div.subsec>h3, div.subsubsec>h4), <eqq> tags, and <figure> tags are done.
<cite> and <refer> tags are rendered to show bubble reference.
<codeprint> tags are printed to corresponding <pre> tags, only when the tags exist in the document.
Current styles (dark/bright mode, font-family, font-size, line-height) are shown.
disqus.js with id="disqus-js" is loaded.
kakao.js with id="kakao-js-sdk" is loaded.
New ShortKeys (T: Table of Contents, F: Forward Section, D: Previous Section, L: To 전체목록/[Lists]) are set.
m.delayPad=512;
m.wait=1024;
wait 753ms.
Doing delayed-load. : 1
<eq> and <eqq> tags are rendered to MathJax format, being enclosed by \ ( \ ) and \ [ \ ].
docuK1 scripts started!
If this log is not closed automatically, there must be an error somewhere in your document or scripts.
Table of Contents is filled out.
Auto numberings of sections (div.sec>h2, div.subsec>h3, div.subsubsec>h4), <eqq> tags, and <figure> tags are done.
<cite> and <refer> tags are rendered to show bubble reference.
<codeprint> tags are printed to corresponding <pre> tags, only when the tags exist in the document.
Current styles (dark/bright mode, font-family, font-size, line-height) are shown.
disqus.js with id="disqus-js" is loaded.
kakao.js with id="kakao-js-sdk" is loaded.
New ShortKeys (T: Table of Contents, F: Forward Section, D: Previous Section, L: To 전체목록/[Lists]) are set.
m.delayPad=512;
m.wait=1024;
wait 753ms.
Doing delayed-load. : 1







현재 docuK SEE 3.0.0 버전에 에러가 있어서 글이 제대로 안보일겁니다. 곧 고칠테니 기다려주세요.
이 글이 도움이 되셨다면, 광고 클릭 한번씩만 부탁드립니다 =ㅂ=ㅋ. (If this article was helpful, please click the ad once. Thank you. ;)
이 글이 도움이 되셨다면, 광고 클릭 한번씩만 부탁드립니다 =ㅂ=ㅋ. (If this article was helpful, please click the ad once. Thank you. ;)
Mode: Bright; Font: Noto Sans KR; font-size: 18.0px (10.0); line-height: 1.6;
width: 1280, height: 720, version: 3.0.0
Canonical URI: https://kipid.tistory.com/entry/Encode-Unescape-and-Decode-Escape-URI-Component
dg:plink (Document Global Permanent Link): https://kipid.tistory.com/126
document.referrer: Empty
width: 1280, height: 720, version: 3.0.0
Canonical URI: https://kipid.tistory.com/entry/Encode-Unescape-and-Decode-Escape-URI-Component
dg:plink (Document Global Permanent Link): https://kipid.tistory.com/126
document.referrer: Empty







Encode/Unescape and Decode/Escape URI Component
http 주소창에 space 나 한글, 특수문자 같은 것들이 낑겨 있을 경우, 여러모로 에러가 날 가능성이 높아져서 보통 브라우저들이 이런 문자들은 '%AB' 같은 8 bit (?) 어쩌구로 변환시켜 버린다. Javascript 에서 기본적으로 이런것들을 처리하는 encodeURIComponent, decodeURIComponent 함수들을 제공한다.
뭐 쓰는 사람은 알아서 공부해서 쓸테니... 인터넷 돌아다니다가 이상한 주소가 실제 어떤 주소인지 궁금할때 이용하시라고 (+내가 쓸라고) 만들어 봄.
Table of Contents
T1.Decode URI Component
▼ Show/Hide
한글같은 경우 3 byte 가 한묶음이라, 제대로 조합이 안맞으면 decode error 남.
On the left side of codes is there a hiden button to toggle/switch scrollability ({max-height:some} or {max-height:none}).
text-decode-result
▲ Hide
T2.Encode URI Component
▼ Show/Hide
On the left side of codes is there a hiden button to toggle/switch scrollability ({max-height:some} or {max-height:none}).
text-encode-result
▲ Hide
T3.Codes
▼ Show/Hide
T3.1.Escape codes manually coded.
//////////////////////////////////////////////////// // Escape and Unescape HTML string. //////////////////////////////////////////////////// m.escapeHTML=function (str) { if (!str||str.constructor!==String) { return ""; } return str.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }; m.escapeOnlyTag=function (str) { if (!str||str.constructor!==String) { return ""; } return str.replace(/</g,'<').replace(/>/g,'>'); }; m.unescapeHTML=function (str) { if (!str||str.constructor!==String) { return ""; } return str.replace(/>/g,'>').replace(/</g,'<').replace(/&/g,'&'); }; m.escapeAMP=function (str) { if (!str||str.constructor!==String) { return ""; } return str.replace(/%/g,'%25').replace(/&/g,'%26').replace(/#/g,'%23'); }; m.unescapeAMP=function (str) { if (!str||str.constructor!==String) { return ""; } return str.replace(/%23/g,'#').replace(/%26/g,'&').replace(/%25/g,'%'); };
T3.2.Using existing functions.
On the left side of codes is there a hiden button to toggle/switch scrollability ({max-height:some} or {max-height:none}).
<script> (function() { $("#text-decode").on("input", function(e) { let $result=$("#text-decode-result"); let str=""; str+="unescape :\n"; try { str+=unescape(this.value); } catch (e) { str+=e; } str+="\n\ndecodeURI :\n"; try { str+=decodeURI(this.value); } catch (e) { str+=e; } str+="\n\ndecodeURIComponent :\n"; try { str+=decodeURIComponent(this.value); } catch (e) { str+=e; } str+="\n\nm.unescapeHTML :\n"; str+=m.unescapeHTML(this.value); str+="\n\nm.unescapeAMP :\n"; str+=m.unescapeAMP(this.value); $result.html(m.escapeHTML(str)); $result.removeClass("prettyprinted"); PR.prettyPrint(function(){}, $result.parent()[0]); }); $("#text-encode").on("input", function(e) { let $result=$("#text-encode-result"); let str=""; str+="escape :\n"; try { str+=escape(this.value); } catch (e) { str+=e; } str+="\n\nencodeURI :\n"; try { str+=encodeURI(this.value); } catch (e) { str+=e; } str+="\n\nencodeURIComponent :\n"; try { str+=encodeURIComponent(this.value); } catch (e) { str+=e; } str+="\n\nm.escapeHTML :\n"; str+=m.escapeHTML(this.value); str+="\n\nm.escapeOnlyTag :\n"; str+=m.escapeOnlyTag(this.value); str+="\n\nm.escapeAMP :\n"; str+=m.escapeAMP(this.value); $result.html(m.escapeHTML(str)); $result.removeClass("prettyprinted"); PR.prettyPrint(function(){}, $result.parent()[0]); }); })(); </script>
▲ Hide
TdocuK0-sec-RRA0.References and Related Articles
▼ Show/Hide
- Ref. [01] w3schools - JavaScript Global Reference
▲ Hide







현재 docuK SEE 3.0.0 버전에 에러가 있어서 글이 제대로 안보일겁니다. 곧 고칠테니 기다려주세요.
이 글이 도움이 되셨다면, 광고 클릭 한번씩만 부탁드립니다 =ㅂ=ㅋ. (If this article was helpful, please click the ad once. Thank you. ;)
이 글이 도움이 되셨다면, 광고 클릭 한번씩만 부탁드립니다 =ㅂ=ㅋ. (If this article was helpful, please click the ad once. Thank you. ;)
반응형
'[IT/Programming] > HTML related' 카테고리의 다른 글
말풍선, inRef 만들기, 만드는 법 in HTML by JavaScript (아랫쪽, 윗쪽, 왼쪽, 오른쪽 말풍선) - 안내서 만들기 (0) | 2024.08.26 |
---|---|
week4 위클리 페이퍼 (리액트가 렌더링 하는 방식을 설명, 리액트에서 Virtual DOM이 무엇인지, 이를 사용하는 이유는 무엇인지 설명, React 에서 컴포넌트란 무엇이며, 함수형 컴포넌트와 클래스 컴포넌트의 차이점을 설명) (1) | 2024.08.25 |
인스타그램 (Instagram) 퍼오는 법 (2) | 2024.08.24 |
week3 위클리 페이퍼 (var, let, const 를 서로 비교 // 자바스크립트에서 this 키워드의 사용과 그 특성에 대해 설명 // 렉시컬 스코프(Lexical Scope)의 개념과 그 특성에 대해 설명) (0) | 2024.08.20 |
코드잇 풀스택 2기 - Week 6 (0) | 2024.08.20 |
코드잇 풀스택 2기 - Week 5 (0) | 2024.08.20 |
코드잇 풀스택 2기 - Week 4 (0) | 2024.08.20 |