首页 全栈极客与开发辅助内容详情

Unicode Converter: Escape Sequences, HTML Entities and Code Points - Three notations, one character, zero confusion

2026-11-17 4 访客
Unicode Converter: Escape Sequences, HTML Entities and Code Points

站点名称:Unicode Converter: Escape Sequences, HTML Entities and Code Points

所属分类:全栈极客与开发辅助

官方网址:https://www.9314.cn/tools/unicode-convert/en/

SEO查询: 爱站网 站长工具

进入网站

站点介绍

Unicode Converter: Escape Sequences, HTML Entities and Code Points

Debugging an incident last quarter, I found a log line that read \u63a5\u53e3\u8d85\u65f6 and a teammate on duty asked me what on earth that was. Decoded, it said "API timeout" in Chinese - four characters nobody in the room could read at that moment. This page exists for exactly that moment: escapes and plain text, properly introduced to each other.

The short version

  • Three notations, both directions: \uXXXX escapes (JS/Java/Python string literals), 你 decimal entities (HTML), U+XXXX code points (spec documents) - one-click style switch with automatic direction detection.
  • Emoji surrogate pairs done right: 😀 comes out as \ud83d\ude00 (a proper pair) in escape mode and merges into U+1F600 in code point mode - naive converters emit half a pair here, which pastes as a tofu box elsewhere.
  • Character grid: below the result, one card per character (glyph + code point + surrogate marker), so verification never involves guessing.
  • Browser-local computation, zero uploads; 1MB cap; mixed \u / decimal entity / hex entity / U+ input decodes fine.

Why one character wears three costumes

A common character's Unicode code point is 4F60 in hexadecimal - that is its identity number. The three costumes are just three typographic habits: JavaScript strings write \u4f60, HTML writes 你 (decimal 20320 is exactly hex 4F60), spec documents write U+4F60. Different parsers, different radices, same character.

So a "wrong conversion" is usually not a wrong character - it is the wrong reader. Paste \u escapes into HTML or entities into JS and they just sit there, untouched.

Why emoji are where converters break

UTF-16 represents characters in 16 bits, capped at 0xFFFF - and 😀 sits at 0x1F600, over the ceiling. So it splits into a surrogate pair: high surrogate \ud83d plus low surrogate \ude00, and only together do they make one emoji. Half a pair renders as a question mark or a box, and in data pipelines it is a dirty code unit. All three styles here handle the pairing correctly, and the round trip is lossless character by character - try bouncing 😀 through every mode and see.

FAQ

How do I turn \u4f60\u597d back into readable text?

Paste it straight into the left pane. The tool detects that the input is mostly \u escapes and flips to decode direction automatically - line breaks are fine, each line is handled on its own. After converting, hit the round swap button to convert back and eyeball the round trip, character by character.

Why does one emoji become two escapes like \ud83d\ude00?

😀 sits at code point U+1F600, above the 0xFFFF ceiling a single UTF-16 value can hold, so it is stored as a surrogate pair: \ud83d is the high surrogate, \ude00 the low one, and only together do they make that one emoji. This is exactly where naive converters break - they emit half a pair and the result pastes as a tofu box elsewhere. All three styles here handle it correctly: escape mode outputs the pair as-is, code point mode merges it into U+1F600.

What is the difference between 😀 and \ud83d\ude00?

Same character, three notations for three consumers. 😀 is a decimal HTML entity for HTML parsers; \ud83d\ude00 is the UTF-16 escape form used in JS/Java/Python string literals; U+1F600 is the raw code point notation humans and spec documents use. Pick whichever style you need - the output follows the selected button, and the swap button converts back and forth between them.

Does it work for rare scripts and historic characters?

Yes, as long as your system has a font with the glyph. Characters in planes above the BMP (code points above 0xFFFF - rare CJK extensions, historic scripts, symbols) go through the same surrogate-pair logic as emoji. The only way you would "see nothing" is a missing font rendering a box - that is a display issue, not a conversion error: copy the result elsewhere or switch fonts and the character is there.

Is my text uploaded anywhere?

No. All conversion happens inside this device's browser - no upload endpoint, works offline. Only the output style preference lives in localStorage; it does not follow you to another device, and "Clear my data" in the footer removes it.

中文版:https://www.9314.cn/tools/unicode-convert/

 暂无评论,快来抢沙发吧~

发布评论