File encoding guides

Distinguish an escaped character from a byte

·

Read and write escaped text fragments or exact byte escapes. Choose Unicode text escapes for characters or Hex byte escapes for binary. Select Encode or Decode.

Escape Sequence Converter

Compare the character é with its bytes

In Unicode text mode, the escape \u00e9 restores é. Its UTF-8 download contains C3 A9. In hex byte mode, \xE9 restores the single byte E9. For the UTF-8 representation in byte mode, supply \xC3\xA9.

RFC 8259 — JSON strings and escapes

Keep literal backslashes when exchanging text

Encoding an actual line feed produces the two-character escape \n. A backslash followed by the letter n needs two escaped backslashes followed by n. Paste the fragment itself when decoding. Surrounding quotation marks are treated as data.

Identify which layer owns a backslash

A JSON document containing the two characters backslash and n escapes that backslash in the JSON source. After parsing the JSON, the field still contains a literal backslash and n. Decoding it as another escape layer would turn those characters into a line break.

Check one representative field before a bulk conversion. Inspect its character count and where a newline appears in the destination. Keep byte escapes for binary data separate from Unicode escapes for text.

Common questions

What happens to a supplementary Unicode character?

Encoding uses a pair of four-digit surrogate escapes. Decoding a valid pair restores one Unicode character.

Does decoding run the input as JavaScript?

The converter parses supported escape sequences as data. An unknown escape or an isolated surrogate produces an error.

Sources

Put it into practice.

Related guides