Unicode to String Literal
Convert Unicode text to escaped string literals for various programming languages.
Paste Unicode text — emoji, accented letters, CJK characters — and get escaped string literals you can drop straight into source code. Pick your target language (JavaScript, Python, Java, Rust, Go, CSS) and the converter handles surrogate pairs and supplementary code points for you. And everything runs in your browser. Nothing gets uploaded.
FAQ
What escape formats are generated?
JavaScript uses \uXXXX and \u{XXXXX}. Python uses \uXXXX and \UXXXXXXXX. Java/C# uses \uXXXX with surrogate pairs for supplementary characters. Rust uses \u{XXXX}. Go uses \uXXXX and \UXXXXXXXX. CSS uses \XXXX.
Are ASCII characters escaped?
Printable ASCII characters (space through tilde, code points 32-126) are kept as-is. Only non-ASCII characters and control characters are escaped.
How are emoji handled in Java/C#?
Java and C# use UTF-16, so emoji (above U+FFFF) require surrogate pairs: two \uXXXX escapes representing the high and low surrogates.
Can I paste the output directly into code?
Yes. The generated string literal is valid syntax for the selected language. Just wrap it in the appropriate quotes for your language.