Skip to content
UniKit

String to Unicode

String to Unicode with local processing and strict input validation.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Text

Result

The result was generated locally.

Enter text to process

What this tool does

  • Encode non-ASCII characters into \uXXXX escape sequences: 你好 becomes \u4f60\u597d, ready to paste into a JS, JSON or Java string literal.
  • ASCII characters are kept as they are, so 你好! comes out as \u4f60\u597d! - punctuation, spaces and letters need no manual fix-up.
  • Astral characters such as emoji emit the full high and low surrogate (😀 becomes \ud83d\ude00), so nothing is lost and unicode2str can restore the original text.

Example

Input

你好😀!

Output

\u4f60\u597d\ud83d\ude00!

Each Chinese code unit becomes a 4-digit escape, the emoji becomes a complete surrogate pair, and the ASCII ! stays as-is; paste the result into unicode2str to restore the original text.

Frequently asked questions

Is empty input supported?

Yes, it returns an empty result.

How is invalid input handled?

It returns an explicit invalid-input error.

Are emoji truncated?

No. An emoji is made of a high and a low surrogate, and both are written out as a complete surrogate pair such as \ud83d\ude00, so unicode2str or the decode mode of u2a restores the 😀 character.

Can the output be copied directly?

Yes. The result is a text Unicode escape sequence with ASCII left untouched, so it can be copied and reused as is.

Keywords:String to Unicodestr2unicodetext encodinglocal tool

Related tools