转义与反转义

处理 JSON、JavaScript、HTML 和 URL

正在加载工具…

关于 转义与反转义

处理 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.

如何使用这个开发者工具

  1. Choose the source and target context.
  2. Paste a small representative value and run escape or unescape.
  3. 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.