{"id":664,"date":"2011-11-30T21:56:28","date_gmt":"2011-11-30T13:56:28","guid":{"rendered":"http:\/\/www.hawkwithwind.net\/blog\/?p=664"},"modified":"2013-06-24T14:49:11","modified_gmt":"2013-06-24T06:49:11","slug":"utf-8%e7%bc%96%e7%a0%81%e7%a0%94%e5%ad%a6","status":"publish","type":"post","link":"https:\/\/www.hawkwithwind.net\/blog\/2011\/11\/30\/utf-8%e7%bc%96%e7%a0%81%e7%a0%94%e5%ad%a6\/","title":{"rendered":"utf-8\u7f16\u7801\u7814\u5b66"},"content":{"rendered":"<p>\u597d\u4e45\u597d\u4e45\u6ca1\u6709\u66f4\u65b0\u535a\u5ba2\u4e86\u3002\u767b\u5f55\u5bc6\u7801\u90fd\u662f\u8f93\u4e86\u56db\u4e94\u904d\u624d\u8f93\u5bf9\u3002<\/p>\n<p>\u6700\u8fd1\u5199\u4e86\u633a\u591a\u90ae\u4ef6\u3002\u76f8\u5bf9\u7684\uff0c\u597d\u50cf\u67d0\u5904\u503e\u6cfb\u6389\u4e86\u4e00\u6837\uff0c\u5c31\u6ca1\u5fc3\u60c5\u5728\u535a\u5ba2\u4e0a\u7801\u5b57\u4e86\u3002\u4e8e\u662f\u4eca\u5929\u4f9d\u65e7\u662f\u704c\u6c34\u7684\u77ed\u7bc7\u5427\u3002<\/p>\n<p>\u6700\u8fd1\u88abutf-8\u641e\u5f97\u5404\u79cd\u5934\u75db\u3002\u5dee\u70b9\u5c31\u8981\u7ec3\u51fa\u8089\u773c\u770b\u4e8c\u8fdb\u5236\u7f16\u7801\u7684\u706b\u773c\u91d1\u775b\u3002\u5148\u4e3e\u4e2a\u4eca\u5929\u9047\u5230\u7684\u5c0f\u95ee\u9898\u5427\u3002<br \/>\njava\u7528gbk\u65b9\u5f0f\u5199\u5165\u7684\u6587\u4ef6\uff0c\u4f3c\u4e4e\u6709\u4e2a\u7279\u6027\uff0c\u662f\u4f1a\u81ea\u52a8\u628agbk\u7f16\u7801\u4e2d\u4e0d\u80fd\u8bc6\u522b\u76840x0\u8fd9\u4e2a\u5b57\u8282\uff0c\u66ff\u6362\u6210&#8221;?&#8221;\uff0c\u4e5f\u53730x3F\u3002\u8fd9\u539f\u672c\u4e5f\u6ca1\u4ec0\u4e48\uff0c\u4f46\u5f53\u4ed6\u8bfb\u53d6utf8\u6587\u672c\u5e76\u91cd\u65b0\u5199\u5165\u65b0\u7684\u6587\u4ef6\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u51fa\u73b0\u504f\u5dee\u3002<br \/>\n\u4f17\u6240\u5468\u77e5\uff0cutf8\u7f16\u7801\u7684\u82f1\u6587\u548c\u7b26\u53f7\u90e8\u5206\u662f\u540cASCII\u7f16\u7801\u517c\u5bb9\u7684\u3002\u540c\u65f6\uff0c\u5728\u5927\u591a\u6570\u4e2d\u6587\u4e2d\uff0c\u5f88\u5c11\u51fa\u73b00x0\u8fd9\u6837\u7684\u5b57\u8282\u3002\u56e0\u6b64\uff0c\u7528ASCII\u786c\u5199utf8\u7f16\u7801\u7684\u4e2d\u82f1\u6df7\u5408\u6587\u5b57\uff0c\u7136\u540e\u8fd9\u4e2a\u6587\u4ef6\u518d\u7528utf8\u7684\u65b9\u5f0f\u6253\u5f00\uff0c\u8fd0\u6c14\u597d\u7684\u8bdd\u5c45\u7136\u53ef\u4ee5\u4fa5\u5e78\u8499\u6df7\u8fc7\u5173\uff0c\u6beb\u65e0\u9519\u8bef\u3002\u7136\u800c\uff0c\u4e00\u65e6\u6587\u5b57\u4e2d\u51fa\u73b0\u4e86\u5e26\u67090x0\u5b57\u8282\u7684utf8\u7f16\u7801\uff0c\u5c31\u6ca1\u90a3\u4e48\u4fa5\u5e78\u4e86\u3002<br \/>\n\u4f8b\u5982\u201c\u4e2a\u6027\u201d\u7684\u6027\u5b57\uff0c\u5176unicode\u7f16\u7801\u4e3a0x6027, \u7ffb\u8bd1\u6210utf8\u7684\u8bdd:<\/p>\n<pre>\r\n\u6027\r\n 60\t    27\r\n 01100000   00100111\r\n[1110]0110 [10]000000 [10]100111\r\n E6\t    80\t       A7\r\n<\/pre>\n<p>\u8fd9\u91cc\u7528\u65b9\u62ec\u53f7\u6807\u8bc6\u4e86utf8\u7684\u5b57\u8282\u5934\uff0c\u65b9\u4fbf\u8fa8\u8bc6\u3002\u5728windows\u4e0a\u662f\u4f7f\u7528\u5c0f\u7aef\u5e8f\uff0c\u6240\u4ee5\u5b9e\u9645\u7684\u5e8f\u5217\u4f1a\u662f\u8fd9\u6837\uff1a<\/p>\n<pre>\r\n0110 1110 0000 1000 0111 1010\r\n<\/pre>\n<p>\u8fd9\u91cc\u7b2c\u4e09\u4e2a\u5b57\u8282\u51fa\u73b0\u4e860x0\uff0c\u60b2\u5267\u53d1\u751f\u4e86\uff0c\u88abjava\u7684\u6d41\u8f93\u51fa\u4e0d\u77e5\u600e\u4e48\u5c31\u90a3\u4e48\u667a\u80fd\u66ff\u6362\u6210\u4e86&#8221;?&#8221;<\/p>\n<pre>\r\n0110 1110 1111 0011 ...\r\n6    E    F    3\r\n<\/pre>\n<p>\u7ed3\u679c\u8fd9\u91cc\u5c31\u4e71\u7801\u4e86\u3002\u6253\u51fa\u6765\u5185\u5bb9\u4e00\u56e2\u7cdf\u3002\u53d8\u6210\u201c\u4e2a&lt;E6&gt;?\u201d\u3002<\/p>\n<p>\u53e6\u5916\u4e00\u4e2a\u66fe\u8ba9\u6211\u5934\u75bc\u4e00\u5929\u7684\u95ee\u9898\uff0c\u5c31\u662f\u6839\u636eutf8\u7f16\u7801\u89c4\u5219\uff0c\u5e76\u4e0d\u4f1a\u51fa\u73b00xC0 0x80\u8fd9\u4e2a\u53cc\u5b57\u3002\u56e0\u4e3a\u5982\u679c\u6309\u7167\u7f16\u7801\u89c4\u8303<\/p>\n<pre>\r\n 0xC0           0x80\r\n[110]0 0000    [10]00 0000\r\n 0000           0000\r\n<\/pre>\n<p>\u8fd9\u6839\u672c\u5c31\u662f0x0\u561b\uff01\u4e0d\u53ef\u80fd\u7f16\u7801\u6210\u8fd9\u4e2a\u6837\u5b50\u7684\u3002wiki\u4e0a\u67e5\u4e86\u534a\u5929\u624d\u53d1\u73b0\uff0c\u539f\u6765\u8fd9\u4e2a\u53c8\u662fwindows\u7684\u4e13\u6709\u89e3\u51b3\u65b9\u6848\u3002\u5b8c\u5168\u662fwindows\u7cfb\u7edf\u4e00\u53a2\u60c5\u613f\uff0c\u60f3\u8981\u533a\u522b\u4e8e\u4e00\u822c\u7684ASCII\u6587\u672c\u800c\u4f5c\u7684\u522b\u626d\u4e8b\u3002\u7ed3\u679c\u8fd9\u6837\u7684\u6587\u672c\u60f3\u8981\u63d2\u5165\u5230mysql\u6570\u636e\u5e93\u65f6\uff0c\u5c31\u4f1a\u88ab\u6570\u636e\u5e93\u8ba4\u4e3a\u662f\u4e0d\u5408\u7406\u7684utf8\u7f16\u7801\u800c\u88ab\u51b7\u51b7\u62d2\u7edd\uff01<br \/>\n\u6240\u4ee5\u6574\u7406utf8\u7684\u7f16\u7801\u95ee\u9898\uff0c\u6709\u65f6\u5019\u8fd8\u662f\u8981\u4e00\u76f4\u770b\u5230\u4e8c\u8fdb\u5236\u4e0a\u9762\u6765\uff0c\u8fd9\u6837\u95ee\u9898\u53d1\u751f\u5728\u54ea\u91cc\u4e5f\u5c31\u4f1a\u6bd4\u8f83\u6e05\u695a\uff0c\u8be5\u600e\u6837\u89e3\u51b3\u5c31\u4e0d\u518d\u50cf\u662f\u9730\u5f39\u67aa\u7f16\u7a0b\uff0c\u5de6\u8bd5\u53f3\u8bd5\u90fd\u4e0d\u77e5\u9053\u54ea\u91cc\u51fa\u9519\u4e86\u54df\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u597d\u4e45\u597d\u4e45\u6ca1\u6709\u66f4\u65b0\u535a\u5ba2\u4e86\u3002\u767b\u5f55\u5bc6\u7801\u90fd\u662f\u8f93\u4e86\u56db\u4e94\u904d\u624d\u8f93\u5bf9\u3002 \u6700\u8fd1\u5199\u4e86\u633a\u591a\u90ae\u4ef6\u3002\u76f8\u5bf9\u7684\uff0c\u597d\u50cf\u67d0\u5904\u503e\u6cfb\u6389\u4e86\u4e00\u6837\uff0c\u5c31\u6ca1\u5fc3\u60c5\u5728\u535a\u5ba2\u4e0a\u7801\u5b57\u4e86\u3002\u4e8e\u662f\u4eca\u5929\u4f9d\u65e7\u662f\u704c\u6c34\u7684\u77ed\u7bc7\u5427\u3002 \u6700\u8fd1\u88abutf-8\u641e\u5f97\u5404\u79cd\u5934\u75db\u3002\u5dee\u70b9\u5c31\u8981\u7ec3\u51fa\u8089\u773c\u770b\u4e8c\u8fdb\u5236\u7f16\u7801\u7684\u706b\u773c\u91d1\u775b\u3002\u5148\u4e3e\u4e2a\u4eca\u5929\u9047\u5230\u7684\u5c0f\u95ee\u9898\u5427\u3002 java\u7528gbk\u65b9\u5f0f\u5199\u5165\u7684\u6587\u4ef6\uff0c\u4f3c\u4e4e\u6709\u4e2a\u7279\u6027\uff0c\u662f\u4f1a\u81ea\u52a8\u628agbk\u7f16\u7801\u4e2d\u4e0d\u80fd\u8bc6\u522b\u76840x0\u8fd9\u4e2a\u5b57\u8282\uff0c\u66ff\u6362\u6210&#8221;?&#8221;\uff0c\u4e5f\u53730x3F\u3002\u8fd9\u539f\u672c\u4e5f\u6ca1\u4ec0\u4e48\uff0c\u4f46\u5f53\u4ed6\u8bfb\u53d6utf8\u6587\u672c\u5e76\u91cd\u65b0\u5199\u5165\u65b0\u7684\u6587\u4ef6\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u51fa\u73b0\u504f\u5dee\u3002 \u4f17\u6240\u5468\u77e5\uff0cutf8\u7f16\u7801\u7684\u82f1\u6587\u548c\u7b26\u53f7\u90e8\u5206\u662f\u540cASCII\u7f16\u7801\u517c\u5bb9\u7684\u3002\u540c\u65f6\uff0c\u5728\u5927\u591a\u6570\u4e2d\u6587\u4e2d\uff0c\u5f88\u5c11\u51fa\u73b00x0\u8fd9\u6837\u7684\u5b57\u8282\u3002\u56e0\u6b64\uff0c\u7528ASCII\u786c\u5199utf8\u7f16\u7801\u7684\u4e2d\u82f1\u6df7\u5408\u6587\u5b57\uff0c\u7136\u540e\u8fd9\u4e2a\u6587\u4ef6\u518d\u7528utf8\u7684\u65b9\u5f0f\u6253\u5f00\uff0c\u8fd0\u6c14\u597d\u7684\u8bdd\u5c45\u7136\u53ef\u4ee5\u4fa5\u5e78\u8499\u6df7\u8fc7\u5173\uff0c\u6beb\u65e0\u9519\u8bef\u3002\u7136\u800c\uff0c\u4e00\u65e6\u6587\u5b57\u4e2d\u51fa\u73b0\u4e86\u5e26\u67090x0\u5b57\u8282\u7684utf8\u7f16\u7801\uff0c\u5c31\u6ca1\u90a3\u4e48\u4fa5\u5e78\u4e86\u3002 \u4f8b\u5982\u201c\u4e2a\u6027\u201d\u7684\u6027\u5b57\uff0c\u5176unicode\u7f16\u7801\u4e3a0x6027, \u7ffb\u8bd1\u6210utf8\u7684\u8bdd: \u6027 60 27 01100000 00100111 [1110]0110 [10]000000 [10]100111 E6 80 A7 \u8fd9\u91cc\u7528\u65b9\u62ec\u53f7\u6807\u8bc6\u4e86utf8\u7684\u5b57\u8282\u5934\uff0c\u65b9\u4fbf\u8fa8\u8bc6\u3002\u5728windows\u4e0a\u662f\u4f7f\u7528\u5c0f\u7aef\u5e8f\uff0c\u6240\u4ee5\u5b9e\u9645\u7684\u5e8f\u5217\u4f1a\u662f\u8fd9\u6837\uff1a 0110 1110 0000 1000 0111 1010 \u8fd9\u91cc\u7b2c\u4e09\u4e2a\u5b57\u8282\u51fa\u73b0\u4e860x0\uff0c\u60b2\u5267\u53d1\u751f\u4e86\uff0c\u88abjava\u7684\u6d41\u8f93\u51fa\u4e0d\u77e5\u600e\u4e48\u5c31\u90a3\u4e48\u667a\u80fd\u66ff\u6362\u6210\u4e86&#8221;?&#8221; 0110 1110 1111 0011 &#8230; 6 E F 3 \u7ed3\u679c\u8fd9\u91cc\u5c31\u4e71\u7801\u4e86\u3002\u6253\u51fa\u6765\u5185\u5bb9\u4e00\u56e2\u7cdf\u3002\u53d8\u6210\u201c\u4e2a&lt;E6&gt;?\u201d\u3002 \u53e6\u5916\u4e00\u4e2a\u66fe\u8ba9\u6211\u5934\u75bc\u4e00\u5929\u7684\u95ee\u9898\uff0c\u5c31\u662f\u6839\u636eutf8\u7f16\u7801\u89c4\u5219\uff0c\u5e76\u4e0d\u4f1a\u51fa\u73b00xC0 0x80\u8fd9\u4e2a\u53cc\u5b57\u3002\u56e0\u4e3a\u5982\u679c\u6309\u7167\u7f16\u7801\u89c4\u8303 0xC0 0x80 [110]0 0000 [10]00 0000 0000 0000 \u8fd9\u6839\u672c\u5c31\u662f0x0\u561b\uff01\u4e0d\u53ef\u80fd\u7f16\u7801\u6210\u8fd9\u4e2a\u6837\u5b50\u7684\u3002wiki\u4e0a\u67e5\u4e86\u534a\u5929\u624d\u53d1\u73b0\uff0c\u539f\u6765\u8fd9\u4e2a\u53c8\u662fwindows\u7684\u4e13\u6709\u89e3\u51b3\u65b9\u6848\u3002\u5b8c\u5168\u662fwindows\u7cfb\u7edf\u4e00\u53a2\u60c5\u613f\uff0c\u60f3\u8981\u533a\u522b\u4e8e\u4e00\u822c\u7684ASCII\u6587\u672c\u800c\u4f5c\u7684\u522b\u626d\u4e8b\u3002\u7ed3\u679c\u8fd9\u6837\u7684\u6587\u672c\u60f3\u8981\u63d2\u5165\u5230mysql\u6570\u636e\u5e93\u65f6\uff0c\u5c31\u4f1a\u88ab\u6570\u636e\u5e93\u8ba4\u4e3a\u662f\u4e0d\u5408\u7406\u7684utf8\u7f16\u7801\u800c\u88ab\u51b7\u51b7\u62d2\u7edd\uff01 \u6240\u4ee5\u6574\u7406utf8\u7684\u7f16\u7801\u95ee\u9898\uff0c\u6709\u65f6\u5019\u8fd8\u662f\u8981\u4e00\u76f4\u770b\u5230\u4e8c\u8fdb\u5236\u4e0a\u9762\u6765\uff0c\u8fd9\u6837\u95ee\u9898\u53d1\u751f\u5728\u54ea\u91cc\u4e5f\u5c31\u4f1a\u6bd4\u8f83\u6e05\u695a\uff0c\u8be5\u600e\u6837\u89e3\u51b3\u5c31\u4e0d\u518d\u50cf\u662f\u9730\u5f39\u67aa\u7f16\u7a0b\uff0c\u5de6\u8bd5\u53f3\u8bd5\u90fd\u4e0d\u77e5\u9053\u54ea\u91cc\u51fa\u9519\u4e86\u54df\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[10],"class_list":["post-664","post","type-post","status-publish","format-standard","hentry","category-post","tag-make-fun-of-codes-and-coders"],"_links":{"self":[{"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/posts\/664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/comments?post=664"}],"version-history":[{"count":9,"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/posts\/664\/revisions"}],"predecessor-version":[{"id":854,"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/posts\/664\/revisions\/854"}],"wp:attachment":[{"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/media?parent=664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/categories?post=664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hawkwithwind.net\/blog\/wp-json\/wp\/v2\/tags?post=664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}