[{"data":1,"prerenderedAt":451},["ShallowReactive",2],{"tool-content-en-text-escape":3},{"id":4,"title":5,"body":6,"description":441,"extension":442,"locale":443,"meta":444,"navigation":445,"path":446,"seo":447,"stem":448,"toolId":449,"__hash__":450},"tools\u002Ftools\u002Fen\u002Ftext-escape.md","Text Escape and Unescape",{"type":7,"value":8,"toc":421},"minimark",[9,14,18,21,24,28,31,42,45,51,95,99,108,114,116,122,138,142,149,155,158,164,183,187,194,200,202,208,219,223,238,241,245,263,269,271,277,288,292,295,301,303,332,335,339,342,348,350,356,359,363,366,380,384,389,396,400,403,407,410,414,417],[10,11,13],"h2",{"id":12},"what-this-tool-does","What this tool does",[15,16,17],"p",{},"This tool puts common text escaping operations in one place. The input is transformed as you switch modes, and the result can be copied, downloaded, or used as the next input for another conversion.",[15,19,20],{},"Enable batch mode to convert every line independently, or load a text file to process its contents. Each line is handled on its own, so one invalid line does not stop the rest.",[15,22,23],{},"All processing happens in the current browser tab. Text is never uploaded to a server.",[10,25,27],{"id":26},"html-escape-and-unescape","HTML escape and unescape",[15,29,30],{},"HTML escaping replaces characters that have special meaning in markup with entities. For example:",[32,33,39],"pre",{"className":34,"code":36,"language":37,"meta":38},[35],"language-text","\u003Cp>Tom & Jerry's\u003C\u002Fp>\n","text","",[40,41,36],"code",{"__ignoreMap":38},[15,43,44],{},"becomes:",[32,46,49],{"className":47,"code":48,"language":37,"meta":38},[35],"&lt;p&gt;Tom &amp; Jerry&#39;s&lt;\u002Fp&gt;\n",[40,50,48],{"__ignoreMap":38},[15,52,53,54,57,58,57,61,57,64,67,68,71,72,57,75,57,78,57,81,57,84,67,87,90,91,94],{},"The tool escapes ",[40,55,56],{},"&",", ",[40,59,60],{},"\u003C",[40,62,63],{},">",[40,65,66],{},"\"",", and ",[40,69,70],{},"'",". Unescaping supports common entities such as ",[40,73,74],{},"&amp;",[40,76,77],{},"&lt;",[40,79,80],{},"&gt;",[40,82,83],{},"&quot;",[40,85,86],{},"&#39;",[40,88,89],{},"&apos;",", plus decimal and hexadecimal numeric entities such as ",[40,92,93],{},"&#x4F60;",". This is useful for displaying user input, but it is not a complete HTML sanitizer or security filter.",[10,96,98],{"id":97},"xml-escape-and-unescape","XML escape and unescape",[15,100,101,102,104,105,107],{},"XML escaping uses the same five characters as HTML but emits the XML-friendly ",[40,103,89],{}," entity for a single quote instead of ",[40,106,86],{},":",[32,109,112],{"className":110,"code":111,"language":37,"meta":38},[35],"\u003Cprice currency=\"USD\">5 > 3 & 2\u003C\u002Fprice>\n",[40,113,111],{"__ignoreMap":38},[15,115,44],{},[32,117,120],{"className":118,"code":119,"language":37,"meta":38},[35],"&lt;price currency=&quot;USD&quot;&gt;5 &gt; 3 &amp; 2&lt;\u002Fprice&gt;\n",[40,121,119],{"__ignoreMap":38},[15,123,124,125,57,127,57,129,57,131,57,133,57,135,137],{},"Unescaping restores ",[40,126,74],{},[40,128,77],{},[40,130,80],{},[40,132,83],{},[40,134,89],{},[40,136,86],{},", and numeric entities. It only restores characters; it does not validate or sanitize XML.",[10,139,141],{"id":140},"url-encode-and-decode","URL encode and decode",[15,143,144,145,148],{},"URL encoding uses the browser's ",[40,146,147],{},"encodeURIComponent",", which is intended for query parameter values, path fragments, or other standalone text that will be placed in a URL:",[32,150,153],{"className":151,"code":152,"language":37,"meta":38},[35],"你好 & hello?\n",[40,154,152],{"__ignoreMap":38},[15,156,157],{},"produces a value similar to:",[32,159,162],{"className":160,"code":161,"language":37,"meta":38},[35],"%E4%BD%A0%E5%A5%BD%20%26%20hello%3F\n",[40,163,161],{"__ignoreMap":38},[15,165,166,167,57,170,57,173,67,175,178,179,182],{},"This mode encodes structural characters such as ",[40,168,169],{},"\u002F",[40,171,172],{},"?",[40,174,56],{},[40,176,177],{},"=",", so it should not be used to encode an entire URL. Decoding requires valid percent sequences such as ",[40,180,181],{},"%E4%BD%A0","; encoding an already encoded value creates double encoding.",[10,184,186],{"id":185},"unicode-encode-and-decode","Unicode encode and decode",[15,188,189,190,193],{},"Unicode encoding outputs each Unicode code point as uppercase ",[40,191,192],{},"U+XXXX"," text separated by spaces:",[32,195,198],{"className":196,"code":197,"language":37,"meta":38},[35],"A 你好😀\n",[40,199,197],{"__ignoreMap":38},[15,201,44],{},[32,203,206],{"className":204,"code":205,"language":37,"meta":38},[35],"U+0041 U+0020 U+4F60 U+597D U+1F600\n",[40,207,205],{"__ignoreMap":38},[15,209,210,211,214,215,218],{},"Decoding accepts both ",[40,212,213],{},"U+4F60"," and ",[40,216,217],{},"\\\\u4F60",", along with 4- to 6-digit hexadecimal code points. Invalid or out-of-range code points are left unchanged.",[10,220,222],{"id":221},"base64-text-encode-and-decode","Base64 text encode and decode",[15,224,225,226,229,230,233,234,237],{},"Base64 converts the UTF-8 bytes of text into printable ASCII. For example, ",[40,227,228],{},"Hello"," becomes ",[40,231,232],{},"SGVsbG8=",". The tool uses UTF-8 so Chinese text and Emoji do not become corrupted by a direct ",[40,235,236],{},"btoa"," call.",[15,239,240],{},"Base64 is an encoding, not encryption. Anyone with the result can recover the original text, so it must not be used to protect passwords, keys, or private data. These modes are for text; use the standalone Base64 tool for files, Data URLs, and URL Safe Base64.",[10,242,244],{"id":243},"javascript-string-escape-and-unescape","JavaScript string escape and unescape",[15,246,247,248,251,252,57,255,258,259,262],{},"JavaScript escaping converts each character into a JavaScript hexadecimal escape: ",[40,249,250],{},"\\xHH"," for code points up to ",[40,253,254],{},"0xFF",[40,256,257],{},"\\uHHHH"," for BMP code points, and surrogate-pair ",[40,260,261],{},"\\uHHHH\\uHHHH"," sequences for astral characters. Characters such as line breaks are also represented by their hexadecimal code points:",[32,264,267],{"className":265,"code":266,"language":37,"meta":38},[35],"Hi 你好\n",[40,268,266],{"__ignoreMap":38},[15,270,44],{},[32,272,275],{"className":273,"code":274,"language":37,"meta":38},[35],"\\x48\\x69\\x20\\u4F60\\u597D\n",[40,276,274],{"__ignoreMap":38},[15,278,279,280,57,282,67,284,287],{},"Unescaping accepts ",[40,281,250],{},[40,283,257],{},[40,285,286],{},"\\u{...}"," sequences. This is useful for embedding arbitrary text in a JavaScript source string without quoting problems.",[10,289,291],{"id":290},"json-string-escape-and-unescape","JSON string escape and unescape",[15,293,294],{},"JSON string escaping applies standard JSON rules to newlines, double quotes, backslashes, and control characters, while retaining the surrounding quotes:",[32,296,299],{"className":297,"code":298,"language":37,"meta":38},[35],"line\n\"quoted\"\n",[40,300,298],{"__ignoreMap":38},[15,302,44],{},[32,304,308],{"className":305,"code":306,"language":307,"meta":38,"style":38},"language-json shiki shiki-themes github-dark-high-contrast github-dark-high-contrast","\"line\\n\\\"quoted\\\"\"\n","json",[40,309,310],{"__ignoreMap":38},[311,312,315,319,323,326,329],"span",{"class":313,"line":314},"line",1,[311,316,318],{"class":317},"sg8On","\"line",[311,320,322],{"class":321},"smbAh","\\n\\\"",[311,324,325],{"class":317},"quoted",[311,327,328],{"class":321},"\\\"",[311,330,331],{"class":317},"\"\n",[15,333,334],{},"The output is one complete JSON string value, not a JSON object or array. Unescaping parses a complete JSON string literal, including its surrounding double quotes, back into the original text. Use the JSON Formatter when you need to format a complete JSON document.",[10,336,338],{"id":337},"sql-single-quote-escape-and-unescape","SQL single-quote escape and unescape",[15,340,341],{},"The SQL mode doubles each single quote inside the input:",[32,343,346],{"className":344,"code":345,"language":37,"meta":38},[35],"SELECT 'name'\n",[40,347,345],{"__ignoreMap":38},[15,349,44],{},[32,351,354],{"className":352,"code":353,"language":37,"meta":38},[35],"SELECT ''name''\n",[40,355,353],{"__ignoreMap":38},[15,357,358],{},"This implements the single-quote doubling rule for SQL string literals. Unescaping collapses each doubled pair back into one single quote. It does not parse SQL and does not replace parameterized queries, prepared statements, or a database driver's safe query API.",[10,360,362],{"id":361},"batch-conversion","Batch conversion",[15,364,365],{},"Turn on batch mode to treat the input as multiple lines. Every line, including empty lines, is converted with the selected mode and the results are joined back with newlines. A line that fails to decode, such as a URL with an incomplete percent sequence, is kept unchanged rather than aborting the whole batch.",[15,367,368,369,57,372,375,376,379],{},"Use the Load file button to read a ",[40,370,371],{},".txt",[40,373,374],{},".md",", or ",[40,377,378],{},".csv"," file into the input, then copy or download the converted lines.",[10,381,383],{"id":382},"common-questions","Common questions",[385,386,388],"h3",{"id":387},"why-did-url-decoding-fail","Why did URL decoding fail?",[15,390,391,392,395],{},"The input may contain a ",[40,393,394],{},"%"," that is not followed by two hexadecimal characters, an incomplete encoding, or bytes that are not valid UTF-8. Make sure the input is a complete encoded URL component.",[385,397,399],{"id":398},"why-is-decoded-base64-text-corrupted","Why is decoded Base64 text corrupted?",[15,401,402],{},"The original bytes may not be UTF-8, or the input may be Base64 for a binary file rather than text. Use the standalone Base64 file mode for binary content.",[385,404,406],{"id":405},"does-html-unescaping-remove-dangerous-tags","Does HTML unescaping remove dangerous tags?",[15,408,409],{},"No. It only restores characters and does not remove scripts, event attributes, or other HTML. Use a reliable HTML sanitization strategy before inserting the result into a page.",[10,411,413],{"id":412},"privacy","Privacy",[15,415,416],{},"Input, output, and conversion all stay in the current browser tab. Nothing is sent to a server or written to local storage.",[418,419,420],"style",{},"html pre.shiki code .sg8On, html code.shiki .sg8On{--shiki-default:#ADDCFF;--shiki-dark:#ADDCFF}html pre.shiki code .smbAh, html code.shiki .smbAh{--shiki-default:#FF9492;--shiki-dark:#FF9492}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":38,"searchDepth":422,"depth":422,"links":423},2,[424,425,426,427,428,429,430,431,432,433,434,440],{"id":12,"depth":422,"text":13},{"id":26,"depth":422,"text":27},{"id":97,"depth":422,"text":98},{"id":140,"depth":422,"text":141},{"id":185,"depth":422,"text":186},{"id":221,"depth":422,"text":222},{"id":243,"depth":422,"text":244},{"id":290,"depth":422,"text":291},{"id":337,"depth":422,"text":338},{"id":361,"depth":422,"text":362},{"id":382,"depth":422,"text":383,"children":435},[436,438,439],{"id":387,"depth":437,"text":388},3,{"id":398,"depth":437,"text":399},{"id":405,"depth":437,"text":406},{"id":412,"depth":422,"text":413},"Escape and decode HTML, XML, JavaScript, JSON, URL, SQL, Unicode, and Base64 text locally, with batch line conversion.","md","en",{},true,"\u002Ftools\u002Fen\u002Ftext-escape",{"title":5,"description":441},"tools\u002Fen\u002Ftext-escape","text-escape","viXtc3q5T2Fd-SzeioouIEfodngZkNBGkYl9jUkAJF0",1792391421068]