Skip to content
OddsockLocal
Local
Source text

Formatting

5 wordsRuns in this browser. Nothing is uploaded.

How to use

  1. Paste text, or a run of \u escapes to decode.
  2. Set Direction. Encode writes four lowercase hex digits per unit.
  3. For an emoji, expect two escapes. That is a surrogate pair, not a duplicated character.
  4. Decode accepts \uXXXX and \u{XXXXXX}.

What is Unicode escapes?

The escape converter writes every UTF-16 code unit as \u followed by four hex digits. Odd socks in the dryer. becomes \u004f\u0064\u0064\u0020\u0073\u006f\u0063\u006b\u0073\u0020\u0069\u006e\u0020\u0074\u0068\u0065\u0020\u0064\u0072\u0079\u0065\u0072\u002e. Letters that did not need escaping are escaped anyway, so the result is a uniform string you can drop into a source file.

Read more

That uniformity is also the trap with characters outside the basic multilingual plane. 🍦 encodes as \ud83c\udf66, two escapes, because those are the UTF-16 surrogates of U+1F366. The code-point page shows the single token U+1F366. Decode on this page also accepts the braced form \u{1F366}, so you can turn a modern escape back into the character even though the encoder itself writes the four-digit form.

Anything that is not a \u escape or whitespace fails on decode. Direction starts on encode. The escapes are lowercase.

Use cases

  • A JSON or JavaScript file needs a string with every character visible, including spaces as \u0020.
  • Someone received \ud83c\udf66 and wants the ice cream character back without misreading it as two letters.
  • A reviewer checks that a library’s escape of an emoji is a surrogate pair and not a single \u1f366, which would be the wrong width.
  • You have a mix of \u00e9 and \u{E9} from two codebases and want both to become é.

The whole sentence as four-digit escapes

Direction encode. Text: Odd socks in the dryer.

\u004f\u0064\u0064\u0020\u0073\u006f\u0063\u006b\u0073\u0020\u0069\u006e\u0020\u0074\u0068\u0065\u0020\u0064\u0072\u0079\u0065\u0072\u002e

Why use Oddsock

Four-digit \u units match what JavaScript and JSON have accepted for years. Braced escapes decode here, but they are not what the encoder writes.

Related tools

Using this tool

The encoder emits UTF-16 code units. U+1F366 is stored as the pair \ud83c\udf66. The code-point converter is the page that prints a single U+1F366.