{"id":399,"date":"2015-09-22T09:40:23","date_gmt":"2015-09-22T01:40:23","guid":{"rendered":"http:\/\/www.huike007.cn\/?p=399"},"modified":"2015-09-22T09:40:23","modified_gmt":"2015-09-22T01:40:23","slug":"unicode-transformation-issues%e5%8e%9f%e7%90%86","status":"publish","type":"post","link":"http:\/\/www.huike007.cn\/?p=399","title":{"rendered":"Unicode transformation issues\u539f\u7406"},"content":{"rendered":"<p>0x01. \u6f0f\u6d1e\u4ecb\u7ecd<br \/>\nUnicode transformation issues\u542b\u4e49\u4e3aUnicode\u8f6c\u6362\u95ee\u9898\u3002\u5728Unicode\u5728\u8f6c\u6362\u65f6\uff0c\u7531\u4e8e\u8d85\u957f\u5b57\u8282\u5e8f\u5217\u548c\u9519\u8bef\u683c\u5f0f\u5f15\u8d77\u5b50\u5e8f\u5217\u7684\u5b89\u5168\u95ee\u9898\u3002\u901a\u8fc7\u7279\u6b8a\u7684\u7f16\u7801\u683c\u5f0f\u7ed5\u8fc7\u7a0b\u5e8f\u5bf9\u6076\u610f\u5b57\u7b26\u7684\u68c0\u6d4b\uff0c\u53ef\u4ee5\u7528\u5728SQL\u6ce8\u5165\u3001XSS\u7b49\u3002<br \/>\n0x02. \u6f0f\u6d1e\u539f\u7406<br \/>\n\u4e00\u3001\u7b80\u8981\u7f16\u7801\u8bf4\u660e<br \/>\n1. ASCII\u7801<br \/>\nASCII \u7801\u4f7f\u7528\u6307\u5b9a\u76847 \u4f4d\u62168 \u4f4d\u4e8c\u8fdb\u5236\u6570\u7ec4\u5408\u6765\u8868\u793a128 \u6216256 \u79cd\u53ef\u80fd\u7684\u5b57\u7b26\u3002\u6807\u51c6ASCII \u7801\u4e5f\u53eb\u57fa\u7840ASCII\u7801\uff0c\u4f7f\u7528\u4e00\u4e2a\u5b57\u8282\u7684\u540e\u97627 \u4f4d\u4e8c\u8fdb\u5236\u6570\u6765\u8868\u793a\u6240\u6709\u7684\u5927\u5199\u548c\u5c0f\u5199\u5b57\u6bcd\uff0c\u6570\u5b570 \u52309\u3001\u6807\u70b9\u7b26\u53f7\uff0c\u4ee5\u53ca\u5728\u7f8e\u5f0f\u82f1\u8bed\u4e2d\u4f7f\u7528\u7684\u7279\u6b8a\u63a7\u5236\u5b57\u7b26\uff0c\u6700\u524d\u9762\u7684\u76841\u4f4d\u7edf\u4e00\u89c4\u5b9a\u4e3a0\u3002<br \/>\n2. Unicode\u7f16\u7801<br \/>\n\u7edf\u4e00\u7801\u7684\u7f16\u7801\u65b9\u5f0f\u4e0eISO 10646\u7684\u901a\u7528\u5b57\u7b26\u96c6\u6982\u5ff5\u76f8\u5bf9\u5e94\u3002\u76ee\u524d\u5b9e\u9645\u5e94\u7528\u7684\u7edf\u4e00\u7801\u7248\u672c\u5bf9\u5e94\u4e8eUCS-2\uff0c\u4f7f\u752816\u4f4d\u7684\u7f16\u7801\u7a7a\u95f4\u3002\u4e5f\u5c31\u662f\u6bcf\u4e2a\u5b57\u7b26\u5360\u75282\u4e2a\u5b57\u8282\u3002\u8fd9\u6837\u7406\u8bba\u4e0a\u4e00\u5171\u6700\u591a\u53ef\u4ee5\u8868\u793a216\uff08\u537365536\uff09\u4e2a\u5b57\u7b26\u3002\u57fa\u672c\u6ee1\u8db3\u5404\u79cd\u8bed\u8a00\u7684\u4f7f\u7528\u3002\u5b9e\u9645\u4e0a\u5f53\u524d\u7248\u672c\u7684\u7edf\u4e00\u7801\u5e76\u672a\u5b8c\u5168\u4f7f\u7528\u8fd916\u4f4d\u7f16\u7801\uff0c\u800c\u662f\u4fdd\u7559\u4e86\u5927\u91cf\u7a7a\u95f4\u4ee5\u4f5c\u4e3a\u7279\u6b8a\u4f7f\u7528\u6216\u5c06\u6765\u6269\u5c55\u3002<br \/>\n\u4e0a\u8ff016\u4f4d\u7edf\u4e00\u7801\u5b57\u7b26\u6784\u6210\u57fa\u672c\u591a\u6587\u79cd\u5e73\u9762\u3002\u57fa\u672c\u591a\u6587\u79cd\u5e73\u9762\u7684\u5b57\u7b26\u7684\u7f16\u7801\u4e3aU+hhhh\uff0c\u5176\u4e2d\u6bcf\u4e2ah\u4ee3\u8868\u4e00\u4e2a\u5341\u516d\u8fdb\u5236\u6570\u5b57\uff0c\u4e0eUCS-2\u7f16\u7801\u5b8c\u5168\u76f8\u540c\u3002\u800c\u5176\u5bf9\u5e94\u76844\u5b57\u8282UCS-4\u7f16\u7801\u540e\u4e24\u4e2a\u5b57\u8282\u4e00\u81f4\uff0c\u524d\u4e24\u4e2a\u5b57\u8282\u5219\u6240\u6709\u4f4d\u5747\u4e3a0\u3002<br \/>\nUnicode\u7684\u5b9e\u73b0\u65b9\u5f0f\u4e0d\u540c\u4e8e\u7f16\u7801\u65b9\u5f0f\u3002\u4e00\u4e2a\u5b57\u7b26\u7684Unicode\u7f16\u7801\u662f\u786e\u5b9a\u7684\u3002\u4f46\u662f\u5728\u5b9e\u9645\u4f20\u8f93\u8fc7\u7a0b\u4e2d\uff0c\u7531\u4e8e\u4e0d\u540c\u7cfb\u7edf\u5e73\u53f0\u7684\u8bbe\u8ba1\u4e0d\u4e00\u5b9a\u4e00\u81f4\uff0c\u4ee5\u53ca\u51fa\u4e8e\u8282\u7701\u7a7a\u95f4\u7684\u76ee\u7684\uff0c\u5bf9Unicode\u7f16\u7801\u7684\u5b9e\u73b0\u65b9\u5f0f\u6709\u6240\u4e0d\u540c\u3002Unicode\u7684\u5b9e\u73b0\u65b9\u5f0f\u79f0\u4e3aUnicode\u8f6c\u6362\u683c\u5f0f\uff08Unicode Transformation Format\uff0c\u7b80\u79f0\u4e3aUTF\uff09<br \/>\n\u4f8b\u5982\uff0c\u5982\u679c\u4e00\u4e2a\u4ec5\u5305\u542b\u57fa\u672c7\u4f4dASCII\u5b57\u7b26\u7684Unicode\u6587\u4ef6\uff0c\u5982\u679c\u6bcf\u4e2a\u5b57\u7b26\u90fd\u4f7f\u75282\u5b57\u8282\u7684\u539fUnicode\u7f16\u7801\u4f20\u8f93\uff0c\u5176\u7b2c\u4e00\u5b57\u8282\u76848\u4f4d\u59cb\u7ec8\u4e3a0\u3002\u8fd9\u5c31\u9020\u6210\u4e86\u6bd4\u8f83\u5927\u7684\u6d6a\u8d39\u3002\u5bf9\u4e8e\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u4ee5\u4f7f\u7528UTF-8\u7f16\u7801\uff0c\u8fd9\u662f\u4e00\u79cd\u53d8\u957f\u7f16\u7801\uff0c\u5b83\u5c06\u57fa\u672c7\u4f4dASCII\u5b57\u7b26\u4ecd\u75287\u4f4d\u7f16\u7801\u8868\u793a\uff0c\u5360\u7528\u4e00\u4e2a\u5b57\u8282\uff08\u9996\u4f4d\u88650\uff09\u3002\u800c\u9047\u5230\u4e0e\u5176\u4ed6Unicode\u5b57\u7b26\u6df7\u5408\u7684\u60c5\u51b5\uff0c\u5c06\u6309\u4e00\u5b9a\u7b97\u6cd5\u8f6c\u6362\uff0c\u6bcf\u4e2a\u5b57\u7b26\u4f7f\u75281-3\u4e2a\u5b57\u8282\u7f16\u7801\uff0c\u5e76\u5229\u7528\u9996\u4f4d\u4e3a0\u62161\u8fdb\u884c\u8bc6\u522b\u3002\u8fd9\u6837\u5bf9\u4ee57\u4f4dASCII\u5b57\u7b26\u4e3a\u4e3b\u7684\u897f\u6587\u6587\u6863\u5c31\u5927\u5927\u8282\u7701\u4e86\u7f16\u7801\u957f\u5ea6\uff08\u5177\u4f53\u65b9\u6848\u53c2\u89c1UTF-8\uff09\u3002<br \/>\n3. UTF-8\u7f16\u7801<br \/>\nUTF-8\uff088-bit Unicode Transformation Format\uff09\u662f\u4e00\u79cd\u9488\u5bf9Unicode\u7684\u53ef\u53d8\u957f\u5ea6\u5b57\u7b26\u7f16\u7801\uff0c\u4e5f\u662f\u4e00\u79cd\u524d\u7f00\u7801\u3002\u5b83\u53ef\u4ee5\u7528\u6765\u8868\u793aUnicode\u6807\u51c6\u4e2d\u7684\u4efb\u4f55\u5b57\u7b26\uff0c\u4e14\u5176\u7f16\u7801\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5b57\u8282\u4ecd\u4e0eASCII\u517c\u5bb9\uff0c\u8fd9\u4f7f\u5f97\u539f\u6765\u5904\u7406ASCII\u5b57\u7b26\u7684\u8f6f\u4ef6\u65e0\u987b\u6216\u53ea\u987b\u505a\u5c11\u90e8\u4efd\u4fee\u6539\uff0c\u5373\u53ef\u7ee7\u7eed\u4f7f\u7528\u3002<br \/>\nUTF-8\u4f7f\u7528\u4e00\u81f3\u56db\u4e2a\u5b57\u8282\u4e3a\u6bcf\u4e2a\u5b57\u7b26\u7f16\u7801\uff1a<\/p>\n<ol>\n<li>128\u4e2aUS-ASCII\u5b57\u7b26\u53ea\u9700\u4e00\u4e2a\u5b57\u8282\u7f16\u7801\uff08Unicode\u8303\u56f4\u7531U+0000\u81f3U+007F\uff09\u3002<\/li>\n<li>\u5e26\u6709\u9644\u52a0\u7b26\u53f7\u7684\u62c9\u4e01\u6587\u3001\u5e0c\u814a\u6587\u3001\u897f\u91cc\u5c14\u5b57\u6bcd\u3001\u4e9a\u7f8e\u5c3c\u4e9a\u8bed\u3001\u5e0c\u4f2f\u6765\u6587\u3001\u963f\u62c9\u4f2f\u6587\u3001\u53d9\u5229\u4e9a\u6587\u53ca\u5b83\u62ff\u5b57\u6bcd\u5219\u9700\u8981\u4e8c\u4e2a\u5b57\u8282\u7f16\u7801\uff08Unicode\u8303\u56f4\u7531U+0080\u81f3U+07FF\uff09\u3002<\/li>\n<li>\u5176\u4ed6\u57fa\u672c\u591a\u6587\u79cd\u5e73\u9762\uff08BMP\uff09\u4e2d\u7684\u5b57\u7b26\uff08\u8fd9\u5305\u542b\u4e86\u5927\u90e8\u5206\u5e38\u7528\u5b57\uff09\u4f7f\u7528\u4e09\u4e2a\u5b57\u8282\u7f16\u7801\u3002<\/li>\n<li>\u5176\u4ed6\u6781\u5c11\u4f7f\u7528\u7684Unicode \u8f85\u52a9\u5e73\u9762\u7684\u5b57\u7b26\u4f7f\u7528\u56db\u5b57\u8282\u7f16\u7801\u3002<\/li>\n<\/ol>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"142\">\n<p align=\"center\"><b>\u4ee3\u7801\u8303\u56f4<\/b><b><\/b><\/p>\n<p align=\"center\"><b>\u5341\u516d\u8fdb\u5236<\/b><b><\/b><\/p>\n<\/td>\n<td width=\"142\">\n<p align=\"center\"><b>\u6807\u91cf\u503c<\/b><b>(scalar value)<\/b><\/p>\n<p align=\"center\"><b>\u4e8c\u8fdb\u5236<\/b><b><\/b><\/p>\n<\/td>\n<td width=\"142\">\n<p align=\"center\"><b>UTF-8<\/b><\/p>\n<p align=\"center\"><b>\u4e8c\u8fdb\u5236<\/b><b>\/<\/b><b>\u5341\u516d\u8fdb\u5236<\/b><b><\/b><\/p>\n<\/td>\n<td width=\"142\">\n<p align=\"center\"><b>\u6ce8\u91ca<\/b><b><\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\" valign=\"top\" width=\"142\"><b>000000-00007F<\/b>128\u4e2a\u4ee3\u7801<\/td>\n<td valign=\"top\" width=\"142\">00000000 00000000 0zzzzzzz<\/td>\n<td valign=\"top\" width=\"142\">0zzzzzzz(<b>00-7F<\/b>)<\/td>\n<td rowspan=\"2\" valign=\"top\" width=\"142\">ASCII\u5b57\u7b26\u8303\u56f4\uff0c\u5b57\u8282\u7531\u96f6\u5f00\u59cb<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"142\">\u4e03\u4e2az<\/td>\n<td valign=\"top\" width=\"142\">\u4e03\u4e2az<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\" valign=\"top\" width=\"142\"><b>000080-0007FF<\/b>1920\u4e2a\u4ee3\u7801<\/td>\n<td valign=\"top\" width=\"142\">00000000 00000yyy yyzzzzzz<\/td>\n<td valign=\"top\" width=\"142\">110yyyyy(<b>C0-DF<\/b>) 10zzzzzz(<b>80-BF<\/b>)<\/td>\n<td rowspan=\"2\" valign=\"top\" width=\"142\">\u7b2c\u4e00\u4e2a\u5b57\u8282\u7531110\u5f00\u59cb\uff0c\u63a5\u7740\u7684\u5b57\u7b26\u670910\u5f00\u59cb<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"142\">\u4e09\u4e2ay\uff1b\u4e8c\u4e2ay\uff1b\u516d\u4e2az<\/td>\n<td valign=\"top\" width=\"142\">\u4e94\u4e2ay\uff1b\u516d\u4e2az<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\" valign=\"top\" width=\"142\">000800-00D7FF00E000-00FFFF61440\u4e2a\u4ee3\u7801<\/td>\n<td valign=\"top\" width=\"142\">00000000 xxxxyyyy yyzzzzzz<\/td>\n<td valign=\"top\" width=\"142\">1110xxxx(E0-EF) 10yyyyyy 10zzzzzz<\/td>\n<td rowspan=\"2\" valign=\"top\" width=\"142\">\u7b2c\u4e00\u4e2a\u5b57\u8282\u75311110\u5f00\u59cb\uff0c\u63a5\u7740\u7684\u5b57\u8282\u753110\u5f00\u59cb<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"142\">\u56db\u4e2ax\uff1b\u56db\u4e2ay\uff1b\u4e8c\u4e2ay\uff1b\u516d\u4e2az<\/td>\n<td valign=\"top\" width=\"142\">\u56db\u4e2ax\uff1b\u516d\u4e2ay\uff1b\u516d\u4e2az<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\" valign=\"top\" width=\"142\">010000-10FFFF1048576\u4e2a\u4ee3\u7801<\/td>\n<td valign=\"top\" width=\"142\">000wwwxx xxxxyyyy yyzzzzzz<\/td>\n<td valign=\"top\" width=\"142\">11110www(F0-F7) 10xxxxxx 10yyyyyy 10zzzzzz<\/td>\n<td rowspan=\"2\" valign=\"top\" width=\"142\">\u5c06\u753111110\u5f00\u59cb\uff0c\u63a5\u7740\u7684\u5b57\u8282\u753110\u5f00\u59cb<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"142\">\u4e09\u4e2aw\uff1b\u4e8c\u4e2ax\uff1b\u56db\u4e2ax\uff1b\u56db\u4e2ay\uff1b\u4e8c\u4e2ay\uff1b\u516d\u4e2az<\/td>\n<td valign=\"top\" width=\"142\">\u4e09\u4e2aw\uff1b\u516d\u4e2ax\uff1b\u516d\u4e2ay\uff1b\u516d\u4e2az<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"center\"><b>Unicode<\/b><b>\u548cUTF-8<\/b><b>\u4e4b\u95f4\u7684\u8f6c\u6362\u5173\u7cfb\u8868<\/b><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"196\">\n<p align=\"center\"><b>UCS-4<\/b><b>\u7f16\u7801<\/b><b><\/b><\/p>\n<\/td>\n<td width=\"372\">\n<p align=\"center\"><b>UTF-8<\/b><b>\u5b57\u8282\u6d41<\/b><b><\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"196\">U+00000000 \u2013 U+0000007F<\/td>\n<td valign=\"top\" width=\"372\">0xxxxxxx<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"196\">U+00000080 \u2013 U+000007FF<\/td>\n<td valign=\"top\" width=\"372\">110xxxxx 10xxxxxx<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"196\">U+00000800 \u2013 U+0000FFFF<\/td>\n<td valign=\"top\" width=\"372\">1110xxxx 10xxxxxx 10xxxxxx<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"196\">U+00010000 \u2013 U+001FFFFF<\/td>\n<td valign=\"top\" width=\"372\">11110xxx 10xxxxxx 10xxxxxx 10xxxxxx<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"196\">U+00200000 \u2013 U+03FFFFFF<\/td>\n<td valign=\"top\" width=\"372\">111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"196\">U+04000000 \u2013 U+7FFFFFFF<\/td>\n<td valign=\"top\" width=\"372\">1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u5982\uff1a\u5e0c\u4f2f\u6765\u8bed\u5b57\u6bcdaleph\uff08?\uff09\u7684Unicode\u4ee3\u7801\u662fU+05D0\uff0c\u6309\u7167\u4ee5\u4e0b\u65b9\u6cd5\u6539\u6210UTF-8:<\/p>\n<ol>\n<li>\u6309\u7167\u4e0a\u9762\u5217\u8868\u6b64\u5b57\u6bcd\u5c5e\u4e8eU+0080\u5230U+07FF\u533a\u57df\uff0c\u8bf4\u660e\u5b83\u4f7f\u7528\u53cc\u5b57\u8282\uff0c110yyyyy 10zzzzzz<\/li>\n<li>\u5341\u516d\u8fdb\u52360x05D0\u6362\u7b97\u6210\u4e8c\u8fdb\u5236\u4e3a101-1101-0000<\/li>\n<li>\u5c06\u8fd9\u4e8c\u8fdb\u5236\u6570\u5b57\u6309\u987a\u5e8f\u653e\u5165\u201cy\u201d\u548c\u201cz\u201d\u7684\u4e24\u90e8\u5206\u4e2d\uff1a110<b>10111 <\/b>10<b>010000<\/b><\/li>\n<li>\u6700\u540e\u7ed3\u679c\u5c31\u662f\u53cc\u5b57\u8282\uff0c\u7528\u5341\u516d\u8fdb\u5236\u8868\u793a\u4e3a0xD7 0x90\uff0c\u8fd9\u5c31\u662f\u5b57\u7b26aleph\uff08?\uff09\u7684UTF-8\u7f16\u7801<\/li>\n<\/ol>\n<p>\u4e8c\u3001\u6f0f\u6d1e\u539f\u7406<br \/>\n\u6839\u636e\u6f0f\u6d1e\u63cf\u8ff0\u53ef\u4ee5\u786e\u5b9a\u662f\u7531\u4e8eUnicode\u8f6c\u7801\u5f15\u8d77\u7684\u5b89\u5168\u95ee\u9898\uff0c\u4eceUnicode\u5b98\u7f51\u53ef\u4ee5\u83b7\u5f97\u4fe1\u606f\u5b58\u5728\u6b64\u5b89\u5168\u95ee\u9898\u7684Unicode\u7248\u672c\u4e3a3.0\uff0c\u5e76\u5728Unicode 3.1\u65f6\u4fee\u590d\u6b64\u6f0f\u6d1e\u3002\u4ece\u4e09\u70b9\u5206\u6790\uff1aBest-Fit Mappings\uff0cOverlong Byte sequences\u548cIll-Formed Subsequences\u3002<br \/>\n1. Best-Fit Mappings<br \/>\n\u5f53\u4e00\u4e2a\u5b57\u7b26X\u8f6c\u7801\u4e3a\u53e6\u4e00\u4e2a\u5b8c\u5168\u4e0d\u540c\u7684\u5b57\u7b26Y\u65f6\uff0c\u53ef\u80fd\u53d1\u751f\u201c\u6700\u4f73\u5339\u914d\u6620\u5c04\u201d\u73b0\u8c61\u3002\u53ef\u80fd\u53d1\u751f\u5728\u4ee5\u4e0b\u5730\u65b9\uff1a<br \/>\na) \u6846\u67b6API\u8f6c\u6362\u8f93\u5165\u5b57\u7b26\u4e3a\u9ed8\u8ba4\u7f16\u7801<br \/>\nb) \u6570\u636e\u4ece\u5bbd\u5b57\u8282\u8f6c\u4e3a\u975e\u5bbd\u5b57\u8282<br \/>\nc) \u6e90\u7f16\u7801\u5b57\u7b26\u7f16\u7801\u4e0d\u5728\u76ee\u6807\u5185\u5bb9\u7684\u7f16\u7801\u4e2d<br \/>\n2. Overlong Byte sequences<br \/>\n\u6839\u636e\u4e0a\u9762\u7f16\u7801\u8f6c\u6362\u8868\uff0c\u4f20\u5165\u201cnon-shortest form\u201d\uff08\u975e\u6700\u77ed\u5f62\u5f0f\uff09\u7684\u5b57\u7b26\u4e32\uff0c\u5982\u679c\u662f\u4e00\u4e2a\u5b58\u5728\u5b89\u5168\u95ee\u9898\u7684Unicode\u8f6c\u7801\uff0c\u8d85\u957f\u5b57\u8282\u5e8f\u5217\u53ef\u80fd\u89e3\u6790\u6210\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u4e32\u3002<br \/>\n3. Ill-Formed Subsequences<br \/>\nUTF-8\u5bf9\u67d0\u5b57\u7b26\u4e32\u7f16\u7801\u3002\u904d\u5386UTF-8\u8f6c\u6362\u5668\u4e2d\u8f93\u5165\u7684UTF-8\u5b57\u8282\uff0c\u7136\u540e\u8f93\u51fa\u5b57\u7b26\u7684\u7f16\u7801\u3002\u5982\u679c\u51fa\u73b0\u9519\u8bef\u683c\u5f0f\uff0c\u5982U+FFFD\uff0cSUB\uff0c\u201c?\u201d\uff0c\u7a7a\u683c\u7b49\u5b57\u7b26\uff0c\u5b83\u4e0d\u80fd\u6d88\u8017\u4e0b\u4e00\u4e2a\u6709\u6548\u7684\u5b57\u8282\u3002<br \/>\n\u4f8b\u5982\uff1a X = &lt;\u2026 41 C0 3E 42 \u2026&gt;<br \/>\n\u6709\u4e00\u4e2a\u9519\u8bef\u683c\u5f0f\u7684\u5b57\u8282\u5e8f\u5217\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u4e00\u4e2a\u9519\u8bef\u683c\u5f0f\u7684\u5b50\u5e8f\u5217&lt;C2&gt;\uff0c\u6309\u7167\u524d\u9762\u7684\u7f16\u7801\u8f6c\u6362\u5185\u5bb9\u5e94\u8be5\u5c5e\u4e8e000080-0007FF\u8303\u56f4\u5185\uff0c\u4e5f\u5c31\u662f110yyyyy(C0-DF) 10zzzzzz(80-BF)\uff0cC2\u5b57\u8282\u5728C0-DF\u4e2d\uff0c\u4f46\u662f3E\u5b57\u8282\u4e0d\u572880-BF\u4e2d\uff0c\u5c31\u4e0d\u80fd\u6d88\u80173E\u5b57\u8282\u4e0e\u5176\u7ec4\u62102\u4e2a\u5b57\u8282\u5b57\u7b26\u3002\u8fd9\u65f6\u5982\u679c\u7ee7\u7eed\u7f16\u7801\u5219\u5220\u9664C2\u5b57\u8282\u6216\u6682\u505c\u89e3\u7801\u3002\u4f46\u662f\u5982\u679cUnicode\u53ef\u4ee5\u89e3\u91ca\u201cnon-shortest form\u201d\uff08\u975e\u6700\u77ed\u5f62\u5f0f\uff09\uff0c\u90a3\u4e48C2\u548c3E\u7ec4\u6210\u4e24\u4e2a\u5b57\u8282\u7684\u5b57\u7b260xC2 0x3E\uff0c\u6309\u7167\u4e0a\u9762\u4f8b\u5b50\u9006\u5411\u88c5\u6362\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u5c060xC2 0x3E\u8f6c\u6362\u6210\u4e8c\u8fdb\u5236\uff1a110<b>00010 <\/b>10<b>111110<\/b>\uff0c\u6ce8\u610f\u7b2c\u4e8c\u4e2a\u5b57\u8282<\/li>\n<li>\u53cc\u5b57\u8282\u5b57\u7b26\u683c\u5f0f\u4e3a110yyyyy 10zzzzzz\uff0c\u83b7\u53d6\u201cy\u201d\u548c\u201cz\u201d\u4e24\u90e8\u5206\u7ec4\u6210\u5b57\u7b26\u7684\u4e8c\u8fdb\u5236\u4e3a\uff1a000-1011-1110<\/li>\n<li>\u5c06\u5f97\u5230\u7684\u4e8c\u8fdb\u5236\u8f6c\u6362\u6210\u5341\u516d\u8fdb\u5236Unicode\u7f16\u7801\u4e3a\uff1aU+BE<\/li>\n<\/ol>\n<p>\u8fd9\u6837\u5728\u5b58\u5728\u6b64\u5b89\u5168\u95ee\u9898\u7684Unicode\u8f6c\u6362UTF-8\u7684\u65f6\u5c31\u4f1a\u51fa\u73b0\u9519\u8bef\u7684\u683c\u5f0f\uff0c\u4ece\u800c\u53ef\u80fd\u4f7f\u7528\u53cc\u5b57\u8282\u7684Unicode\u5b57\u7b26\u8f6c\u6362UTF-8\u7f16\u7801\u65f6\u5408\u6210\u7279\u6b8a\u5b57\u7b26\u3002<br \/>\n<a class=\"fancybox\" href=\"http:\/\/ends.cc\/wp-content\/uploads\/2014\/03\/4.png\" rel=\"fancybox\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-28\" src=\"http:\/\/ends.cc\/wp-content\/uploads\/2014\/03\/4-300x127.png\" alt=\"4\" width=\"300\" height=\"127\" \/><\/a><br \/>\n0x03. \u6d4b\u8bd5\u73af\u5883<br \/>\n\u6ca1\u627e\u5230\u5408\u9002\u7684\uff0c\u53ea\u5728\u6d4b\u8bd5\u4e2d\u53d1\u73b0\u8fc7\u4e00\u6b21<br \/>\n0x04. \u6f0f\u6d1eEXP<br \/>\n\u660e\u6587\uff1a\u201d\/&gt;&lt;script&gt;alert(\/Ends\/)&lt;\/script&gt;<br \/>\n2\u5b57\u8282\u7f16\u7801\uff1a%C0%A2%C0%AF%C0%BE%C0%BC%C1%B3%C1%A3%C1%B2%C1%A9%C1%B0%C1%B4%C0%BE%C1%A1%C1%AC%C1%A5%C1%B2%C1%B4%C0%A8%C0%AF%C1%85%C1%AE%C1%A4%C1%B3%C0%AF%C0%A9%C0%BC%C0%AF%C1%B3%C1%A3%C1%B2%C1%A9%C1%B0%C1%B4%C0%BE<br \/>\n0x05. \u4fee\u8865\u5efa\u8bae<br \/>\n1\u3001 \u5347\u7ea7Unicode\u7248\u672c\u81f3\u5b98\u65b9\u6700\u65b0\u7a33\u5b9a\u7248\u672c<a href=\"http:\/\/www.unicode.org\/\"><span style=\"color: #000080;\">http:\/\/www.unicode.org<\/span><\/a><br \/>\n2\u3001 Unicode\u8f6c\u5316UTF-8\u7f16\u7801\u540e\uff0c\u5bf9\u8f6c\u6362\u540e\u8fdb\u884c\u5b89\u5168\u68c0\u6d4b\uff0c\u5bf9\u7279\u6b8a\u5b57\u7b26\u8fc7\u6ee4\u6216\u8fdb\u884c\u5b89\u5168\u7f16\u7801\u540e\u8f93\u51fa\u3002<br \/>\n0x06. \u6837\u4f8b\u622a\u56fe<br \/>\n<a class=\"fancybox\" href=\"http:\/\/ends.cc\/wp-content\/uploads\/2014\/03\/5.png\" rel=\"fancybox\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-29\" src=\"http:\/\/ends.cc\/wp-content\/uploads\/2014\/03\/5-300x116.png\" alt=\"5\" width=\"300\" height=\"116\" \/><\/a><br \/>\n0x07. \u53c2\u8003\u8d44\u6599<\/p>\n<ol>\n<li><a href=\"http:\/\/www.unicode.org\/reports\/tr36\/\"><span style=\"color: #000080;\">http:\/\/www.unicode.org\/reports\/tr36\/<\/span><\/a><\/li>\n<li><a href=\"http:\/\/www.acunetix.com\/blog\/news\/acunetix-20130308-new-tests\/\"><span style=\"color: #000080;\">http:\/\/www.acunetix.com\/blog\/news\/acunetix-20130308-new-tests\/<\/span><\/a><\/li>\n<li><a href=\"http:\/\/zh.wikipedia.org\/wiki\/UTF-8\"><span style=\"color: #000080;\">http:\/\/zh.wikipedia.org\/wiki\/UTF-8<\/span><\/a><\/li>\n<li><a href=\"http:\/\/zh.wikipedia.org\/wiki\/Unicode#Unicode.E5.AD.97.E7.AC.A6.E5.B9.B3.E9.9D.A2.E6.98.A0.E5.B0.84\"><span style=\"color: #000080;\">http:\/\/zh.wikipedia.org\/wiki\/Unicode#Unicode.E5.AD.97.E7.AC.A6.E5.B9.B3.E9.9D.A2.E6.98.A0.E5.B0.84<\/span><\/a><\/li>\n<li><a href=\"http:\/\/www.ietf.org\/rfc\/rfc3987.txt\"><span style=\"color: #000080;\">http:\/\/www.ietf.org\/rfc\/rfc3987.txt<\/span><\/a><\/li>\n<li><a href=\"http:\/\/www.blackhat.com\/presentations\/bh-usa-09\/WEBER\/BHUSA09-Weber-UnicodeSecurityPreview-PAPER.pdf\"><span style=\"color: #000080;\">http:\/\/www.blackhat.com\/presentations\/bh-usa-09\/WEBER\/BHUSA09-Weber-UnicodeSecurityPreview-PAPER.pdf<\/span><\/a><\/li>\n<li><a href=\"http:\/\/www.casaba.com\/files\/Chris_Weber_Character%20Transformations%20v1.7_IUC33.pdf\"><span style=\"color: #000080;\">http:\/\/www.casaba.com\/files\/Chris_Weber_Character%20Transformations%20v1.7_IUC33.pdf<\/span><\/a><\/li>\n<li><a href=\"http:\/\/websecuritytool.codeplex.com\/\"><span style=\"color: #000080;\">http:\/\/websecuritytool.codeplex.com\/<\/span><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>0x01. \u6f0f\u6d1e\u4ecb\u7ecd Unicode transformation issues\u542b\u4e49\u4e3aUnicode\u8f6c\u6362\u95ee\u9898\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[180],"tags":[358],"_links":{"self":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts\/399"}],"collection":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=399"}],"version-history":[{"count":1,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts\/399\/revisions"}],"predecessor-version":[{"id":400,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts\/399\/revisions\/400"}],"wp:attachment":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=399"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}