🔤 字符编码:A 在电脑里是 65🔤 Character Encoding: A Is 65 Inside
上一片里,8 个比特组成 1 字节,能数 0~255。可电脑只认识数字,字母 A 和汉字“你”又该住进哪里?Last leaf, 8 bits formed 1 byte that counts 0–255. But the computer only speaks numbers — so where do the letter A and the character 你 live?
第 1 步:字符和数字拉钩约定Step 1: Characters shake hands with numbers
办法很直接:全世界拉钩,一人一张对照表。The fix is direct: the whole world agrees on one lookup table.
💻 小电脑墙上贴着对照表:看见 A 存 65,看见 a 存 97,看见 0 存 48。英文加符号不到 128 个,一张小表全装下——这张表就叫 ASCII。💻 The little computer keeps a table on its wall: see A, store 65; see a, store 97; see 0, store 48. English plus symbols fits in under 128 rows — that little table is called ASCII.
可中文有几万字,一张小表哪装得下?But Chinese has tens of thousands of characters — how could one little table hold them?
第 2 步:中文也有专属号码,用错表就乱码Step 2: Chinese gets its own numbers — wrong table, gibberish
Unicode 给每个字符发专属号码(“你” = U+4F60),UTF-8 负责把号码存成字节。同一串数字,用对表解出“你好”,用错表就是一堆乱码。内容没丢,换对表重解就好。Unicode hands every character its own number (你 = U+4F60), and UTF-8 packs numbers into bytes. The same digits decode into “hello” with the right table — gibberish with the wrong one. Nothing is lost; decode again with the right table.
那我们天天发的 😀 呢?它也有号码吗?And the 😀 we send every day — does it have a number too?
第 3 步:表情也是编码Step 3: Emoji are codes too
💻 小电脑盖章确认:😀 的号码是 U+1F600,存的照样是数字。手机能互相斗图,正是因为全世界用同一套号码本。💻 The little computer stamps it confirmed: 😀 is number U+1F600 — still just digits inside. Phones can trade stickers only because the whole world shares one number book.
🎮 你来当翻译官(30 秒)🎮 Your turn: translator duty (30 seconds)
记住三张表的约定,再接 4 单派件:A、“你”、😀 各是什么码,最后一单修好乱码。Memorize the three tables, then take 4 orders: the codes for A, 你 and 😀 — and fix the gibberish in the last one.
一句话记住它:字符编码 = 字符和数字的对照约定,存字符就是存数字。Remember it in one line: a character encoding is the agreed table between characters and numbers — storing a character means storing a number.
ASCII:大写 A=65、小写 a=97、字符 0=48ASCII: capital A=65, lowercase a=97, digit 0=48中文:Unicode 发号码(如 U+4F60),UTF-8 存字节Chinese: Unicode hands out numbers (like U+4F60), UTF-8 packs bytes乱码 = 两边用了不同的表,换对表重解就好Gibberish = two sides used different tables — decode again with the right one
内容参考 OpenStax 等公开教材,多来源核对 · AI 生成、人工审核 · 发现错误欢迎指正,帮这片叶子长得更好。Based on OpenStax and other open textbooks, cross-checked across sources · AI-generated, human-reviewed · Spotted a mistake? Tell us — help this leaf grow.