{"id":242,"date":"2024-10-15T23:54:18","date_gmt":"2024-10-15T15:54:18","guid":{"rendered":"http:\/\/blog.minegician.cn\/?p=242"},"modified":"2024-10-16T06:38:17","modified_gmt":"2024-10-15T22:38:17","slug":"%e5%85%b3%e4%ba%8eunicode%e7%9a%84%e4%b8%80%e6%ac%a1%e5%ad%a6%e4%b9%a0","status":"publish","type":"post","link":"http:\/\/blog.minegician.cn\/?p=242","title":{"rendered":"\u5173\u4e8eUnicode\u7684\u4e00\u6b21\u5b66\u4e60"},"content":{"rendered":"<h4>\u5f15\u5165\uff1aUnicode \u5bb6\u65cf<\/h4>\n<p>Unicode \u5bb6\u65cf\u4e3b\u8981\u662f UTF-8\uff0cUTF-16\uff0cUTF-32\uff0c\u5b83\u4eec\u90fd\u53ef\u4ee5\u7528\u591a\u8fbe 4 \u5b57\u8282\u5bf9\u5b57\u7b26\u8fdb\u884c\u7f16\u7801<\/p>\n<p>\uff08Unicode Transfer Format\uff09UTF \u540e\u9762\u7684\u6570\u5b57\u8868\u793a\u5355\u4e2a\u7f16\u7801\u6240\u9700\u7684\u6700\u5c0f\u5355\u4f4d\u957f\u5ea6<\/p>\n<p>\u56e0\u6b64 UTF-32 \u662f\u5b9a\u957f\u7f16\u7801<\/p>\n<p>\u53e6\u5916\u4e24\u4e2a\u662f\u4e0d\u5b9a\u957f\u7f16\u7801\uff0cUTF-8 \u53ef\u4ee5\u662f 1\/2\/3\/4 \u5b57\u8282\uff0cUTF-16 \u53ef\u4ee5\u662f 2\/4 \u5b57\u8282\uff08\u672c\u4eba\u613f\u79f0\u5176\u4e3a\u534a\u5b9a\u957f\u7f16\u7801\uff09<\/p>\n<h5>\u8fd9\u51e0\u79cd\u7f16\u7801\u600e\u4e48\u6765\u7684\uff1f<\/h5>\n<p>Unicode \u65e9\u671f\uff0c\u63a8\u884c\u7684\u662f\u5b9a\u957f\u7f16\u7801\uff08\u89e3\u6790\u65e0\u9700\u7b97\u6cd5\uff0c\u6027\u80fd\u6781\u81f4\uff09<\/p>\n<p>\u5b9a\u957f\u7f16\u7801\u5305\u542b 16 \u4f4d\u548c 32 \u4f4d\u65b9\u6848\uff0c\u5373\u5728\u652f\u6301\u751f\u50fb\u5b57\u7b26\u548c\u8282\u7701\u5185\u5b58\u95f4\u505a\u4e00\u4e2a\u53d6\u820d<\/p>\n<ul>\n<li>16 \u4f4d\u80fd\u8868\u793a\u7684 65536 \u4e2a\u5b57\u7b26\uff0c\u79f0\u4e3a<strong>\u57fa\u672c\u591a\u8bed\u8a00\u5e73\u9762<\/strong>\uff08<strong>BMP<\/strong>\uff0cU+0000 \u5230 U+FFFF\uff09<\/li>\n<\/ul>\n<blockquote>\n<p>\u7531\u4e8e\u4ee5\u591a\u5b57\u8282\u4e3a\u5355\u4f4d\uff0cUTF-16 \u548c 32 \u5f15\u5165\u4e86\u4e00\u4e2aBOM\u673a\u5236\uff0c\u7528\u4e8e\u5728\u6587\u4ef6\u5f00\u5934\u6807\u8bc6\u5185\u90e8\u5b57\u8282\u662f\u5927\u7aef\/\u5c0f\u7aef<\/p>\n<p>\u800c\u540e\u6765\u7684 UTF-8 \u4ee5\u5355\u5b57\u8282\u4e3a\u5355\u4f4d\uff0c\u6240\u4ee5\u4e5f\u4e0d\u9700\u8981BOM\u4e86<\/p>\n<p>\uff08\u81f3\u4e8e\u7f16\u8f91\u5668\u4e2d\u53ef\u9009\u7684 UTF-8 with BOM \u7f16\u7801\uff0c\u6211\u7684\u8bc4\u4ef7\u522b\u7ba1\uff0c\u522b\u7528\u3002\u81f3\u4e8e\u4e3a\u4ec0\u4e48\uff0c\u53ef\u4ee5\u770b\u6700\u540e\uff09<\/p>\n<p>\u53ef\u4ee5\u770b\u5230\u5f88\u65e9\u652f\u6301 Unicode \u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u90fd\u662f\u652f\u6301 UTF-16<\/p>\n<\/blockquote>\n<p>\u540e\u6765\u7f51\u7edc\u53d1\u5c55\u5bf9\u6570\u636e\u4f20\u8f93\u7684\u9700\u8981\uff0c\u4f7f UTF-32 \u8fd9\u4f4d\u5728\u5b57\u7b26\u7f16\u7801\u65b9\u9762\u5f7b\u5e95\u5165\u571f\u4e86<\/p>\n<blockquote>\n<p>\u5f53\u7136\uff0c\u4e0d\u8003\u8651\u5185\u5b58\u5360\u7528\u7684\u8bdd\uff0cUTF-32 \u4f9d\u7136\u5177\u6709\u4fe1\u606f\u91cf\u5927\u3001\u64cd\u4f5c\u7b80\u5355\u5feb\u6377\u7684\u4f18\u70b9<\/p>\n<p>\u4e3b\u8981\u662f\u6d6a\u8d39\u7684\u4f4d\u592a\u591a\uff0c\u88ab\u4e92\u8054\u7f51\u9886\u57df\u553e\u5f03\u4e86<\/p>\n<\/blockquote>\n<p>\u4e4b\u540e UTF-16 \u63a5\u8fc7\u7f16\u7801\u5168\u4e16\u754c\u8bed\u8a00\u7684\u5927\u65d7\uff0c\u6210\u4e3a\u4e86\u4e0d\u5b9a\u957f\u7f16\u7801\uff0c\u63a8\u51fa\u4e86<strong>\u4ee3\u7406\u5bf9<\/strong>\u7b97\u6cd5<\/p>\n<p>\u518d\u4e4b\u540e\uff0c\u7b97\u6cd5\u66f4\u7cbe\u5999\u3001\u5b58\u50a8\u66f4\u7d27\u51d1\u7684 UTF-8 \u8bde\u751f\u4e86\uff0c\u9010\u6b65\u6210\u4e3a\u5982\u4eca Unicode \u7684\u4ee3\u8868\uff0c\u662f\u5982\u4eca\u4e92\u8054\u7f51\u4e3b\u63a8\u7684\u901a\u7528\u7f16\u7801<\/p>\n<p>\u4e0b\u9762\u662f\u7f16\u7801\u89c4\u5219<\/p>\n<h4>UTF-8 \u7684\u7f16\u7801\u89c4\u5219\uff08\u4ee5\u4e8c\u8fdb\u5236\u5f62\u5f0f\u8868\u793a\uff09<\/h4>\n<h6>1 \u5b57\u8282\u7f16\u7801<\/h6>\n<blockquote>\n<p>\u9002\u7528\u4e8e U+0000 \u81f3 U+007F \u7684\u7801\u70b9\uff0c\u5373\u539f ASCII \u5b57\u7b26<\/p>\n<p>\u4e8c\u8fdb\u5236\u5f62\u5f0f\uff1a<code>0xxxxxxx<\/code><\/p>\n<\/blockquote>\n<p>7 \u4f4d\u6709\u6548\u6570\u636e\uff0c\u6700\u9ad8\u4f4d\u4e3a 0<\/p>\n<h6>2 \u5b57\u8282\u7f16\u7801<\/h6>\n<blockquote>\n<p>\u9002\u7528\u4e8e U+0080 \u81f3 U+07FF \u7684\u7801\u70b9<\/p>\n<p>\u4e8c\u8fdb\u5236\u5f62\u5f0f\uff1a<code>110xxxxx 10xxxxxx<\/code><\/p>\n<\/blockquote>\n<p>\u7b2c\u4e00\u4e2a\u5b57\u8282\u4ee5 <code>110<\/code> \u5f00\u5934\uff0c\u540e\u7eed\u5b57\u8282\u4ee5 <code>10<\/code> \u5f00\u5934<\/p>\n<p>11 \u4f4d\u6709\u6548\u6570\u636e\uff08$5+6$\uff09<\/p>\n<h6>3 \u5b57\u8282\u7f16\u7801<\/h6>\n<blockquote>\n<p>\u9002\u7528\u4e8e U+0800 \u81f3 U+FFFF \u7684\u7801\u70b9<\/p>\n<p>\u4e8c\u8fdb\u5236\u5f62\u5f0f\uff1a<code>1110xxxx 10xxxxxx 10xxxxxx<\/code><\/p>\n<\/blockquote>\n<p>\u7b2c\u4e00\u4e2a\u5b57\u8282\u4ee5 <code>1110<\/code> \u5f00\u5934\uff0c\u540e\u7eed\u5b57\u8282\u4ee5 <code>10<\/code> \u5f00\u5934<\/p>\n<p>16 \u4f4d\u6709\u6548\u6570\u636e\uff08$4+6*2$\uff09\uff0c\u591a\u4e86 5 \u4f4d<\/p>\n<h6>4 \u5b57\u8282\u7f16\u7801<\/h6>\n<blockquote>\n<p>\u9002\u7528\u4e8e U+10000 \u81f3 U+10FFFF \u7684\u7801\u70b9<\/p>\n<p>\u4e8c\u8fdb\u5236\u5f62\u5f0f\uff1a<code>11110xxx 10xxxxxx 10xxxxxx 10xxxxxx<\/code><\/p>\n<\/blockquote>\n<p>\u7b2c\u4e00\u4e2a\u5b57\u8282\u4ee5 <code>11110<\/code> \u5f00\u5934\uff0c\u540e\u7eed\u5b57\u8282\u4ee5 <code>10<\/code> \u5f00\u5934<\/p>\n<p>21 \u4f4d\u6709\u6548\u6570\u636e\uff08$3+6*3$\uff09\uff0c\u591a\u4e86 5 \u4f4d<\/p>\n<h5>\u5177\u4f53\u7f16\u7801\u793a\u4f8b\uff08\u4ee5\u6700\u590d\u6742\u7684 4 \u5b57\u8282\u4e3a\u4f8b\uff09<\/h5>\n<p>U+1F600\uff08\ud83d\ude00\uff0cUnicode \u7801\u70b9 128512\uff09<\/p>\n<ol>\n<li>\u4f4d\u6570&gt;16\uff0c\u8d85\u8fc7 3 \u5b57\u8282\u7684\u8868\u793a\u80fd\u529b\uff0c\u56e0\u6b64\u91c7\u7528 4 \u5b57\u8282<\/li>\n<li>\u5199\u6210\u4e8c\u8fdb\u5236\uff1a<code>00000001 11110110 00000000<\/code><\/li>\n<li>\u53d6 21 \u4f4d\uff1a<code>000<\/code>|<code>00001 11110110 00000000<\/code><\/li>\n<li>\u586b\u7a7a\u9898\uff1a<code>11110___ 10______ 10______ 10______<\/code><\/li>\n<li>\u586b\u7a7a\u540e\uff1a<code>11110000 10011111 10011000 10000000<\/code><\/li>\n<li>\u7ed3\u679c\u4e3a\uff1a<code>0xF0 0x9F 0x98 0x80<\/code><\/li>\n<\/ol>\n<p>\u987a\u4fbf\u63d0\u4f9b\u4e00\u4e2a\u4f9b\u9a8c\u8bc1\u7684 Java \u51fd\u6570\uff1a<\/p>\n<pre><code class=\"language-java\">public void checkUtf8Code() {\n    int codePoint = 0x1F600;\n    String emoji = new String(Character.toChars(code));\n    \/\/ \u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a8\u4f4d\u5b57\u8282\u6570\u7ec4\n    byte[] utf8Bytes = emoji.getBytes(StandardCharsets.UTF_8);\n    \/\/ \u4ee516\u8fdb\u5236\u8f93\u51fa\n    System.out.print(&quot;UTF-8 \u7f16\u7801\u7684\u5b57\u8282\u503c: &quot;);\n    for (byte b : utf8Bytes) {\n        System.out.printf(&quot;%02X &quot;, b);\n    }\n}<\/code><\/pre>\n<blockquote>\n<ul>\n<li>\u8fd9\u662f\u5426\u5e94\u8be5\u662f Java \u57fa\u7840\u7bc7\u5c31\u8bb2\u7684\u4e1c\u897f\uff1f<\/li>\n<\/ul>\n<p>Java \u57fa\u672c\u7c7b\u578b char \u56fa\u5b9a\u4e3a16\u4f4d\uff0cString \u7c7b\u5185\u90e8\u4e5f\u662f\u4ee5 <code>char[]<\/code> \u5b58\u50a8\u503c<\/p>\n<p>\u521b\u5efa String \u5bf9\u8c61\u65f6\u4f1a\u8fdb\u884c\u4e00\u6b21 encode \u8f6c\u4e3a UTF-16 \u5b58\u50a8\uff0c\u8f93\u51fa\u65f6\u4f1a\u518d\u8fdb\u884c\u4e00\u6b21\u8f6c\u6362\uff0c\u5305\u62ec <code>charAt<\/code> \u83b7\u53d6\u67d0\u5b57\u7b26<\/p>\n<p>\u4f46 <code>charAt<\/code> \u662f\u9ed8\u8ba4\u6bcf\u4e2a\u5b57\u7b26\u53ea\u5360\u7528 16 \u4f4d\uff0c\u8d85\u51fa BMP \u7684\u5b57\u7b26\u4f1a\u4ee5 2 \u4e2a <code>char<\/code> \u4fdd\u5b58\uff0c\u8fd4\u56de\u7684\u7ed3\u679c\u5c31\u6b6a\u4e86<\/p>\n<p>\u8fd9\u5c31\u547c\u5e94\u4e86\u524d\u9762\u8bf4 UTF-16 \u662f\u534a\u5b9a\u957f\u7f16\u7801<\/p>\n<p>\u76f8\u6bd4\u4e4b\u4e0b\uff0c\u771f\u6b63\u7684\u4e0d\u5b9a\u957f\u7f16\u7801 UTF-8 \u5728\u5404\u5927\u7f16\u7a0b\u8bed\u8a00\u5f53\u4e2d\u90fd\u662f\u5b57\u8282\u6570\u7ec4\uff0c\u7136\u540e\u5916\u6302\u4e00\u7cfb\u5217\u5904\u7406\u7b97\u6cd5<\/p>\n<\/blockquote>\n<h4>UTF-8 \u7684\u5b9e\u9645\u7f16\u7801\u8303\u56f4\uff1f<\/h4>\n<p>Unicode \u8bbe\u8ba1\u65f6\u5b58\u5728\u4e00\u4e2a\u4e0a\u9650<\/p>\n<p>\u540c\u65f6\u51fa\u4e8e\u7f16\u7801\u610f\u4e49\u7684\u552f\u4e00\u6027\uff0c\u6709\u4e9b &gt;1 \u5b57\u8282\u7684\u7f16\u7801\u662f\u88ab\u8df3\u8fc7\u7684<\/p>\n<h5>\u907f\u514d\u5197\u4f59\u7f16\u7801<\/h5>\n<p>\u4ee5 1 \u5b57\u8282\u7684 ASCII \u7801\u4e3a\u4f8b\uff0c\u5f53\u6211\u5728 7 \u4f4d\u7801\u524d\u52a0 0000\uff0c\u4fbf\u5f97\u5230\u4e86\u503c\u4e0d\u53d8\u7684 2 \u5b57\u8282\u7801<\/p>\n<p>\u4e8e\u662f\u8fd9\u4e9b\u7801\u88ab\u8ba4\u4e3a\u662f\u5197\u4f59\u7684\uff0c\u65e0\u6548\u7684<\/p>\n<p>\u4ee5\u6b64\u7c7b\u63a8\uff0c\u628a\u591a\u5b57\u8282\u591a\u51fa\u7684\u6570\u636e\u4f4d\u8bbe\u4e3a 0 \u540c\u7406\uff0c\u90fd\u53ef\u4ee5\u627e\u5230\u66f4\u5c11\u5b57\u8282\u7684\u8868\u793a<\/p>\n<p>\u56e0\u6b64\u53ef\u4ee5\u8f7b\u6613\u5f97\u51fa\uff0c2 \u5b57\u8282\u7684\u524d 4 \u4f4d\u4e0d\u80fd\u90fd\u4e3a 0\uff0c3\/4 \u5b57\u8282\u7684\u524d 5 \u4f4d\u4e0d\u80fd\u90fd\u4e3a 0<\/p>\n<p>\u4e8e\u662f\u5f97\u51fa\u4e86\u4e00\u7cfb\u5217\u65e0\u6548\u7f16\u7801\u533a\u95f4<\/p>\n<h5>\u907f\u514d\u4e0e UTF-16 \u6df7\u6dc6<\/h5>\n<p>UTF-16 \u901a\u8fc7<strong>\u4ee3\u7406\u5bf9<\/strong>\u7b97\u6cd5\uff0c\u8868\u793a\u8d85\u51fa BMP \u7684\u5b57\u7b26<\/p>\n<p>\u800c\u4ee3\u7406\u5bf9\u5f62\u5f0f\u7684\u8303\u56f4\u662f U+D800 \u5230 U+DFFF<\/p>\n<p>\u4e8e\u662f UTF-8 \u4fbf\u8df3\u8fc7\u4e86\u8fd9\u4e2a\u8303\u56f4<\/p>\n<p>\u7279\u522b\u662f\u5728 3 \u5b57\u8282\u7f16\u7801\u7684\u8303\u56f4\u4e2d\uff0c<code>0xED 0xA0<\/code> \u5230 <code>0xED 0xBF<\/code> \u4f1a\u88ab\u8df3\u8fc7\uff0c\u4ee5\u786e\u4fdd\u4e0d\u4f1a\u7f16\u7801\u65e0\u6548\u7684 U+D800 \u5230 U+DFFF \u8303\u56f4\u7684\u503c\u3002<\/p>\n<h5>\u907f\u514d\u8d85\u51fa\u6709\u6548\u7684 Unicode \u8303\u56f4<\/h5>\n<p>Unicode \u5b9a\u4e49\u4e86\u7801\u70b9\u7684\u8303\u56f4\u662f U+0000 \u5230 U+10FFFF\uff0c\u8d85\u8fc7\u8fd9\u4e2a\u8303\u56f4\u7684\u7801\u70b9\u662f\u65e0\u6548\u7684<\/p>\n<p>\u56e0\u6b64 4 \u5b57\u8282\u7f16\u7801\u4e2d\uff0c<code>0xF4<\/code> \u540e\u9762\u7684\u5b57\u8282\u53ea\u80fd\u4ece <code>0x80<\/code> \u5230 <code>0x8F<\/code><\/p>\n<p>\u524d\u4e24\u5b57\u8282\u793a\u610f\uff1a<code>11110_100<\/code>|<code>10_001111<\/code><\/p>\n<blockquote>\n<p>\u4e3a\u4ec0\u4e48\u662f\u8fd9\u4e2a\u4e0a\u9650\uff1f<\/p>\n<p>\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u4e2a\u4e0a\u9650\u6b63\u597d\u662f 65536 \u7684 16 \u500d\uff0c\u5b83\u7684\u5236\u5b9a\u4e0e UTF-16 \u7684<strong>\u4ee3\u7406\u5bf9<\/strong>\u606f\u606f\u76f8\u5173<\/p>\n<\/blockquote>\n<h4>UTF-16 \u7684\u4ee3\u7406\u5bf9<\/h4>\n<p>\u4ee3\u7406\u5bf9\u662f UTF-16 \u7684\u4e00\u79cd\u4e0d\u5b9a\u957f\u7f16\u7801\u7684\u5b9e\u73b0\u673a\u5236\uff0c\u901a\u8fc7\u6307\u5b9a\u683c\u5f0f\u6807\u8bc6\u8fde\u7eed\u4e24\u4e2a 16 \u4f4d\u503c\u8868\u793a\u7684\u4e00\u4e2a UTF-16 \u5b57\u7b26<\/p>\n<p>\u800c\u8fd9\u4e24\u4e2a\u503c\u88ab\u79f0\u4e3a\u201c\u4ee3\u7406\u5bf9\u201d\uff08Surrogate Pairs\uff09\uff0c\u5206\u4e3a\u9ad8\u4ee3\u7406\u548c\u4f4e\u4ee3\u7406<\/p>\n<h5>\u7b97\u6cd5\u7b80\u8ff0<\/h5>\n<p>\u4ecd\u4ee5 U+1F600 \uff08\ud83d\ude00\uff09\u4e3a\u4f8b\u3002\u5b66\u7f16\u7a0b\u771f\u662f\u4ee4\u4eba\u5fc3\u60c5\u6109\u60a6\u554a\uff08\uff1f\uff09<\/p>\n<ol>\n<li>\n<p>\u4f4d\u6570&gt;16\uff0c\u56e0\u6b64\u91c7\u7528\u4ee3\u7406\u5bf9<\/p>\n<\/li>\n<li>\n<p>\u51cf\u53bb 0x10000\uff0c\u5f97\u5230 <code>0x1F600 - 0x10000 = 0xF600<\/code><\/p>\n<\/li>\n<li>\n<p>\u5728\u9ad8\u4f4d\u8865 0\uff0c\u81f3 20 \u4f4d\uff0c\u5f97\u5230 <code>0000<\/code>|<code>1111011000000000<\/code><\/p>\n<\/li>\n<li>\n<p>\u5206\u6210\u9ad8 10 \u4f4d <code>00.0011.1101<\/code> \u548c\u4f4e 10 \u4f4d <code>10.0000.0000<\/code>\uff0c\u5373 <code>0x003D<\/code> \u548c <code>0x0200<\/code><\/p>\n<\/li>\n<li>\n<p>\u9ad8 10 \u4f4d\u52a0\u4e0a <code>0xD800<\/code>\uff0c\u5f97\u5230 <code>0xD83D<\/code><\/p>\n<p>\u4f4e 10 \u4f4d\u52a0\u4e0a <code>0xDC00<\/code>\uff0c\u5f97\u5230 <code>0xDE00<\/code><\/p>\n<\/li>\n<li>\n<p>\u4e8e\u662f\u5f97\u5230\u7f16\u7801\u540e\u7684\u503c <code>0xD83D 0xDE00<\/code>\uff0c\u5373\u4ee3\u7406\u5bf9<\/p>\n<\/li>\n<\/ol>\n<blockquote>\n<p>\u4ee3\u7406\u5bf9\u5360\u7528\u4e86 U+D800 \u5230 U+DFFF\uff0c\u4e0d\u5141\u8bb8\u76f4\u63a5\u5206\u914d\u5b57\u7b26\u7ed9\u5b83\u4eec\uff0c\u800c\u662f\u7528\u4e8e\u7f16\u7801 U+10000 \u53ca\u4ee5\u4e0a\u7684\u7801\u70b9<\/p>\n<\/blockquote>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f9b\u9a8c\u8bc1\u7684 Java \u51fd\u6570\uff1a<\/p>\n<pre><code class=\"language-java\">public static void checkUtf16Code() {\n    int codePoint = 0x1F600;\n    \/\/ \u83b7\u53d616\u4f4d\u5b57\u7b26\u6570\u7ec4\n    char[] surrogatePair = Character.toChars(codePoint);\n    \/\/ \u4ee516\u8fdb\u5236\u8f93\u51fa\n    System.out.printf(&quot;\u9ad8\u4ee3\u7406: %04X\\n&quot;, (int) surrogatePair[0]);\n    System.out.printf(&quot;\u4f4e\u4ee3\u7406: %04X\\n&quot;, (int) surrogatePair[1]);\n}<\/code><\/pre>\n<h4>\u8865\u5145\uff1aBOM \u7684\u6807\u8bb0<\/h4>\n<p>UTF-16 \u548c UTF-32 \u90fd\u9009\u62e9 <code>0xFE FF<\/code> \u4e3a\u5927\u7aef\u6807\u8bb0\uff0c<code>0xFF FE<\/code> \u4e3a\u5c0f\u7aef\u6807\u8bb0\uff08\u5f53\u7136 UTF-32 \u524d\u9762\u518d\u52a0 16 \u4f4d 0\uff09<\/p>\n<p>\u4e8e\u662f\u6587\u4ef6\u5f00\u5934\u7684\u7b2c\u4e00\u4e2a\u5b57\u7b26\uff0c\u5c31\u662f BOM \u6807\u8bb0<\/p>\n<p>\u4e00\u822c\u6587\u4ef6\u5904\u7406\u7684\u65f6\u5019\uff0c\u4f1a\u4e0d\u7ea6\u800c\u540c\u5730\u5ffd\u7565\u8fd9\u4e2a\u5b57\u7b26<\/p>\n<blockquote>\n<p>\u5173\u4e8e\u4e3a\u4ec0\u4e48\u4f7f\u7528 <code>FE<\/code> \u548c <code>FF<\/code>\uff0c\u5176\u5b9e\u5c31\u662f\u4e1a\u754c\u5e38\u89c1\u7684\u64cd\u4f5c\uff1a\u62ff\u7528\u4e0d\u5230\u7684\u6700\u5927\u5b57\u8282\u4f5c\u7279\u6b8a\u7528\u9014<\/p>\n<p>\u800c\u6392\u5217\u987a\u5e8f\u5219\u9075\u4ece\u76f4\u89c9\uff1a<code>FE FF<\/code> \u987a\u5e8f\u6392\u5217\uff0c\u5bf9\u5e94\u9ad8\u4f4d\u5728\u524d\u7684\u5927\u7aef\uff0c\u800c <code>FF FE<\/code> \u9006\u5e8f\u6392\u5217\uff0c\u5bf9\u5e94\u4f4e\u4f4d\u5728\u524d\u7684\u5c0f\u7aef<\/p>\n<\/blockquote>\n<h5>UTF-8 \u7684 BOM<\/h5>\n<p>\u5982\u679c\u4e00\u8def\u770b\u5230\u8fd9\u91cc\uff0c\u5e94\u8be5\u80fd\u660e\u767d UTF-8 \u7684 <code>EF BB BF<\/code> \u5f62\u5f0f\u7684 BOM \u662f\u600e\u4e48\u56de\u4e8b\u4e86<\/p>\n<blockquote>\n<p>\u4e0d\u5356\u5173\u5b50\uff0c\u8bd5\u7740\u7528 UTF-8 \u7f16\u7801\u4e00\u4e0b\u5927\u7aef\u7684 <code>FE FF<\/code><\/p>\n<\/blockquote>\n<p>UTF-8 \u6309\u7406\u8bf4\u662f\u4e0d\u9700\u8981 BOM \u7684<\/p>\n<p>\u81f3\u5c11 UTF-8 \u6587\u4ef6\u5904\u7406\u65f6\uff0c\u4e0d\u89c1\u5f97\u4f1a\u8fa8\u8ba4\u7b2c\u4e00\u4e2a\u5b57\u7b26\u662f\u6587\u672c\u5b57\u7b26\uff0c\u8fd8\u662f BOM \u6807\u8bb0<\/p>\n<p>\u6240\u4ee5\u4e0d\u662f\u7279\u6b8a\u9700\u6c42\u7684\u8bdd\uff0c\u8bf7\u4e0d\u8981 [\u8fd9\u662f\u4ec0\u4e48\uff0cUTF-8 with BOM\uff1f\u4fdd\u5b58\u4e00\u4e0b]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u5165\uff1aUnicode \u5bb6\u65cf Unicode \u5bb6\u65cf\u4e3b\u8981\u662f UTF-8\uff0cUTF-16\uff0cUTF-32\uff0c\u5b83\u4eec\u90fd\u53ef\u4ee5\u7528\u591a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":243,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-242","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-3"],"_links":{"self":[{"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=\/wp\/v2\/posts\/242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=242"}],"version-history":[{"count":2,"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=\/wp\/v2\/posts\/242\/revisions"}],"predecessor-version":[{"id":245,"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=\/wp\/v2\/posts\/242\/revisions\/245"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=\/wp\/v2\/media\/243"}],"wp:attachment":[{"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=242"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.minegician.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}