關於 轉義與反轉義
處理 JSON、JavaScript、HTML 和 URL
Escaping is not one universal operation. The correct result depends on where the value will be inserted and how the receiving parser interprets quotes, backslashes, angle brackets, line breaks, and percent signs.
點樣用呢個開發者工具
- Choose the source and target context.
- Paste a small representative value and run escape or unescape.
- Inspect delimiters and control characters, then validate the result with the parser that will consume it.
私隱同資料處理
Conversions happen locally in the browser. Use redacted examples and remember that escaping does not sanitize untrusted input or make a value safe for a different context.
相關開發者工具
常見問題
Is escaping the same as sanitizing?
No. Escaping represents characters for one context; sanitization removes or restricts unsafe content according to the target parser and policy.
Why did the output gain backslashes?
JSON and JavaScript string literals use backslashes to represent quotes, line breaks, and other control characters inside a string.
Can I use HTML escaping inside a URL?
No. Use the encoding rules of the target context. HTML entities and URL percent-encoding solve different problems.