Text to Unicode escape (\uXXXX)
Handy for Java properties files and translation files that cannot hold Arabic letters directly.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter text, format and escape ascii letters too.
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
Each character is mapped to its Unicode code point. \uXXXX writes UTF-16 units as 4 hex digits (characters above FFFF become a pair), \u{X} writes the whole code point, and Python style uses \UXXXXXXXX above FFFF.
Example
Inputs: Format = \uXXXX (Java, JavaScript, JSON), Escape ASCII letters too = no. Result: Escaped text: \u0645\u0631\u062D\u0628\u0627 \uD83D\uDE00; Characters: 7.
مرحبا 😀
\u0645\u0631\u062D\u0628\u0627 \uD83D\uDE00
Limits and caveats
- ASCII letters and spaces stay as they are unless you tick the option; the U+XXXX list includes every character.
- A character built from several code points, like some emoji, shows as several codes.
Questions about this tool
What is the code for the Arabic letter meem?
م is code point U+0645, written \u0645 in Java and JavaScript.
Why does an emoji become two codes \uD83D\uDE00?
UTF-16 represents characters above FFFF as a surrogate pair; the \u{1F600} format writes it as one code.
Which format should I use for a properties file?
Use \uXXXX, the format Java reads in properties files.
