{"id":1598,"date":"2009-04-01T23:39:00","date_gmt":"2009-04-01T14:39:00","guid":{"rendered":"https:\/\/hdmr.org\/d\/?e=324"},"modified":"2009-04-01T23:39:00","modified_gmt":"2009-04-01T14:39:00","slug":"blogn-324","status":"publish","type":"post","link":"https:\/\/hdmr.org\/d\/?e=324","title":{"rendered":"Unicode\u306b\u3053\u3060\u308f\u308b\u304b\u3089\u304b\u3001\u3046\u307e\u304f\u3044\u304b\u306a\u3044"},"content":{"rendered":"<p>\u3048\u3048\u52a0\u6e1b\u6563\u9aea\u306b\u884c\u3063\u3066\u304d\u305f\u3002<br \/>\u3053\u308c\u3067\u3082\u304b\u3063\u3066\u3050\u3089\u3044\u5207\u3063\u3066\u3082\u3089\u3063\u305f\u3002<br \/>\u540c\u3058\u5024\u6bb5\u3067\u3084\u3063\u3066\u3082\u3089\u3046\u306e\u304c\u7533\u3057\u8a33\u306a\u3044\u3050\u3089\u3044\u5207\u3063\u3066\u3082\u3089\u3063\u305f\u3002<br \/>\u307e\u3041\u5148\u5ef6\u3070\u3057\u3057\u3066\u304d\u3066\u9aea\u306e\u6bdb\u304c\u3059\u3054\u3044\u4f38\u3073\u3066\u3084\u3063\u3068\u6563\u9aea\u306b\u3044\u304f\u3068\u3044\u3046\u306e\u306f\u3072\u3069\u3044\u3067\u3059\u304c\u3001<br \/>\u3057\u304b\u3057\u3059\u3063\u304d\u308a\u3057\u305f\u306e\u3067\u3053\u308c\u3067\u3088\u3057\u3068\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\u305d\u3046\u3044\u3048\u3070\u4eca\u65e5\u306f\u30a8\u30a4\u30d7\u30ea\u30eb\u30d5\u30fc\u30eb\u304b\u3002\u5197\u8ac7\u3092\u8a00\u3046\u65e5\u3067\u306f\u3042\u308b\u3051\u308c\u3069\u3001<br \/>\u3057\u304b\u3057\u305d\u3093\u306a\u65e5\u306b\u306a\u306b\u3084\u3089\u771f\u9762\u76ee\u306b\u767a\u8868\u3059\u308b\u3068\u3053\u308d\u3082\u3042\u308b\u308f\u3051\u3060\u3057\u306d\u3002<br \/>\u3060\u304b\u3089\u30a8\u30a4\u30d7\u30ea\u30eb\u30d5\u30fc\u30eb\u306b\u4fbf\u4e57\u3057\u305f\u884c\u52d5\u306f\u3001\u5fc5\u305a\u3057\u3082\u5197\u8ac7\u3058\u3083\u306a\u3044\u306e\u3060\u3088\u3068\u3044\u3046\u306e\u306f\u6700\u8fd1\u601d\u3046\u3068\u3053\u308d\u3067\u3059\u306d\u3002<\/p>\n<hr \/>\n<p>URL\u3067\u4f7f\u3048\u308b\u6587\u5b57\u306fRFC3986\u306b\u3088\u308c\u3070\u6570\u5b57\u30fb\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u30fb\u30cf\u30a4\u30d5\u30f3\u30fb\u30d4\u30ea\u30aa\u30c9\u30fb\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\u30fb\u30c1\u30eb\u30c0\u3089\u3057\u3044\u3002<br \/>\u3053\u308c\u4ee5\u5916\u306e\u6587\u5b57\u306f%E5\u306a\u3069\u3057\u3066\u8868\u793a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3068\u3002<br \/>PHP\u4f7f\u3063\u3066\u308b\u3068\u3053\u306e\u8fba\u306f\u81ea\u52d5\u7684\u306b\u8003\u3048\u3066\u304f\u308c\u308b\u306e\u3067\u3001\u3042\u307e\u308a\u6c17\u306b\u3057\u306a\u304f\u3066\u3044\u3044\u3002<br \/>\u305f\u3060\u53d7\u3051\u53d6\u3063\u305f\u6587\u5b57\u5217\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306f\u308f\u304b\u3089\u306a\u3044\u306e\u3067\u3001\u5185\u90e8\u3067\u4f7f\u3063\u3066\u308b\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306b\u7d71\u4e00\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304c\u3002<br \/>\u3057\u304b\u3057\u53d7\u3051\u53d6\u308b\u306e\u3082UTF-8\u3001\u4f7f\u3046\u306e\u3082UTF-8\u306a\u3089\u6c17\u306b\u3059\u308b\u3053\u3068\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u3002<br \/>\u4f5c\u308b\u306e\u306furlencode\u95a2\u6570\u3067\u3067\u304d\u308b\u305d\u3046\u3060\u3002<\/p>\n<hr \/>\n<p>Perl\u3067\u3053\u308c\u3092\u3084\u308b\u306b\u306f\u6b63\u898f\u8868\u73fe\u3067\u7f6e\u63db\u3059\u308b\u306e\u304c\u666e\u901a\u3067\u3059\u306d\u3002<\/p>\n<pre>my $x='%83R%83%93%83Z%83%93%83g%82%a9%82%e7%89%ce%82%aa%95%ac%82%a2%82%bd';<br \/>$x=~s\/%([0-9A-Fa-f]{2})\/pack('C',hex($1))\/eg;<br \/>print $x;<\/pre>\n<p>\u3053\u3053\u3067\u306fuse utf8;\u306e\u985e\u306f\u3057\u306a\u3044\u3067\u3001Shift_JIS\u3067\u51fa\u529b\u3059\u308c\u3070\u7aef\u672b\u3067\u898b\u308c\u308b\u3053\u3068\u3092\u8003\u3048\u308b\u3002<br \/>\u6709\u540d\u306a\u65b9\u6cd5\u3067\u3059\u306d\u3002<br \/>\u305f\u3060\u4ee5\u524dpack(&#8216;C&#8217;,hex($1))\u306f\u304b\u306a\u308a\u7121\u99c4\u306b\u898b\u3048\u308b\u304b\u3089chr(hex($1))\u3068\u66f8\u304f\u65b9\u304c\u3088\u3044\u306e\u3067\u306f\u3068\u3044\u3046\u306e\u3092\u898b\u305f\u3053\u3068\u304c\u3042\u308b\u3002<br \/>\u50d5\u3082\u305d\u308c\u306b\u306f\u8cdb\u6210\u3067\u3059\u306d\u3002\u3068\u3044\u3046\u308f\u3051\u3067\u4ee5\u4e0b\u306f\u305d\u3093\u306a\u98a8\u306b\u66f8\u304d\u307e\u3059\u3002<br \/>\u307e\u3041Perl\u3067CGI\u4f5c\u308b\u308f\u3051\u3067\u3082\u306a\u3044\u306e\u3067\u3053\u308c\u3060\u3051\u306a\u3089\u8a18\u4e8b\u306b\u3059\u308b\u3053\u3068\u3067\u306f\u306a\u3044\u306e\u3060\u304c\u3001<br \/>\u305f\u3060\u3053\u308c\u304c\u601d\u60d1\u901a\u308a\u884c\u304b\u306a\u3044\u3053\u3068\u3082\u3042\u308b\u3093\u3067\u3059\u306d\u3002<\/p>\n<hr \/>\n<p>\u305d\u308c\u304cuse utf8;\u306e\u985e\u3092\u4f7f\u3063\u305f\u3068\u304d\u3067\u3059\u306d\u3002<\/p>\n<pre>use encoding 'shiftjis';<br \/>use Encode;<br \/>binmode(STDOUT,':encoding(shiftjis)');<br \/>my $x='%e3%83%9e%e3%83%b3%e3%83%9b%e3%83%bc%e3%83%ab%e3%81%8c%e5%90%b9%e3%81%a3%e9%a3%9b%e3%82%93%e3%81%a0';<br \/>$x=~s\/%([0-9A-Fa-f]{2})\/chr(hex($1))\/eg;<br \/>print decode('utf8',$x);<\/pre>\n<p>use encoding &#8216;shiftjis&#8217;;\u3068\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u304cShift_JIS\u3067\u3042\u308b\u3068\u793a\u3059\u3002<br \/>\u305d\u3046\u3059\u308b\u3068\u6025\u306b\u3046\u307e\u304f\u884c\u304b\u306a\u304f\u306a\u308b\u3002<br \/>use utf8;\u306a\u3089\u554f\u984c\u306a\u304f\u3044\u304f\u3053\u3068\u3082\u591a\u3044\u3051\u3069\u3001\u307e\u3041\u305f\u307e\u306b\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u3068\u304d\u3082\u3042\u308b\u3002<br \/>\u5b9f\u306f\u305d\u3046\u3082\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u9593\u9055\u3063\u3066\u306a\u3044\u3093\u3067\u3059\u3088\u3002<br \/>\u3053\u306e\u3042\u305f\u308a\u304cuse utf8;\u306e\u96e3\u3057\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<hr \/>\n<p>use utf8;\u306e\u985e\u3092\u5ba3\u8a00\u3059\u308b\u3068\u666e\u901a\u306f\u6587\u5b57\u5217\u306bUTF-8\u30d5\u30e9\u30b0\u3068\u3044\u3046\u306e\u304c\u7acb\u3064\u3002<br \/>\u3053\u308c\u306f\u6587\u5b57\u3092Unicode\u3067\u8868\u3057\u3066\u304a\u304f\u3059\u308b\u30e2\u30fc\u30c9\u3067\u3059\u306d\u3002<br \/>print ord(&#8216;\u7530&#8217;);\u3068\u3057\u305f\u3068\u304d\u3001Shift_JIS\u306e\u74b0\u5883\u306a\u3089\u3070\u666e\u901a\u306f147\u3068\u51fa\u3066\u304f\u308b\u3002<br \/>\u3068\u3044\u3046\u306e\u3082&#8217;\u7530&#8217;\u306f0x93\u30680x39\u306e2\u30d0\u30a4\u30c8\u3067\u8868\u3055\u308c\u308b\u3002\u305d\u306e1\u30d0\u30a4\u30c8\u76ee\u306f0x93\u300110\u9032\u6570\u306b\u76f4\u3059\u3068147\u3068\u306a\u308b\u308f\u3051\u3060\u3002<br \/>\u3057\u304b\u3057use utf8;\u306e\u985e\u3092\u3059\u308b\u3068\u3001\u3053\u306e\u7d50\u679c\u306f30000\u3068\u306a\u308b\u3002<br \/>\u3053\u306e\u3068\u304d\u306f\u7530\u3068\u3044\u3046\u306e\u306f0x7350\u3068\u8a18\u9332\u3055\u308c\u3066\u3044\u308b\u308f\u3051\u3060\u3002\u305d\u306e1\u6587\u5b57\u76ee\u306e0x7350\u309210\u9032\u6570\u306b\u76f4\u3059\u306830000\u3068\u3002<br \/>\u305d\u306e\u9055\u3044\u304c\u304b\u306a\u308a\u5384\u4ecb\u306a\u3093\u3067\u3059\u306d\u3002<br \/>\u3068\u3044\u3046\u306e\u306f\u3053\u306e\u7f6e\u63db\u306e\u3068\u304d\u3001%e3\u3068\u3044\u3046\u306e\u3092\u767a\u898b\u3057\u305f\u3089\u3001chr(hex(&#8216;e3&#8217;))\u306b\u7f6e\u304d\u63db\u3048\u308b\u308f\u3051\u3060\u304c\u3001<br \/>\u3053\u308c\u304c\u5384\u4ecb\u3067\u3001use utf8;\u3057\u3066\u308b\u3068Unicode\u306e0xE3\u306b\u7f6e\u304d\u63db\u3048\u3066\u3057\u307e\u3046\u3002<\/p>\n<hr \/>\n<p>UTF-8\u30d5\u30e9\u30b0\u81ea\u4f53\u306f\u3053\u3046\u3084\u3063\u305f\u3089\u5916\u305b\u308b\u3093\u3067\u3059\u306d\u3002<\/p>\n<pre>$x=encode('utf8',$x);<\/pre>\n<p>\u3057\u304b\u3057\u3053\u308c\u3067\u5916\u3057\u305f\u3068\u3053\u308d\u3067\u72b6\u6cc1\u304c\u6539\u5584\u3055\u308c\u308b\u308f\u3051\u3067\u3082\u306a\u3044\u3002<br \/>\u4e00\u4f53\u3069\u3046\u306a\u3063\u3066\u3044\u308b\u306e\u3060\u308d\u3046\u304b\u3002<br \/>\u3084\u306f\u308a\u3053\u3046\u3044\u3046\u3053\u3068\u306fUTF-8\u30d5\u30e9\u30b0\u3092\u3064\u3051\u306a\u3044\u306e\u304c\u3088\u3044\u306e\u3060\u308d\u3046\u304b\u3002<\/p>\n<pre>use strict;<br \/>use warnings;<br \/>use encoding 'shiftjis';<br \/>use Encode;<br \/>binmode(STDOUT,':encoding(shiftjis)');<br \/>my $x;<br \/>{<br \/>  no encoding 'shiftjis';<br \/>  $x='%e3%83%9e%e3%83%b3%e3%83%9b%e3%83%bc%e3%83%ab%e3%81%8c%e5%90%b9%e3%81%a3%e9%a3%9b%e3%82%93%e3%81%a0';<br \/>  $x=~s\/%([0-9A-Fa-f]{2})\/pack('C',hex($1))\/eg;<br \/>}<br \/>print decode('utf8',$x);<\/pre>\n<p>\u3068\u308a\u3042\u3048\u305a\u3053\u3046\u3059\u308c\u3070\u3046\u307e\u304f\u3044\u304f\u3088\u3046\u306b\u306a\u3063\u305f\u3002<br \/>\u3057\u304b\u3057\u3069\u3046\u3057\u305f\u3082\u306e\u304b\u306a\u3002\u5168\u90e8Unicode\u3068\u3044\u3046\u306e\u3082\u56f0\u3063\u305f\u3082\u306e\u3060\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3048\u3048\u52a0\u6e1b\u6563\u9aea\u306b\u884c\u3063\u3066\u304d\u305f\u3002\u3053\u308c\u3067\u3082\u304b\u3063\u3066\u3050\u3089\u3044\u5207\u3063\u3066\u3082\u3089\u3063\u305f\u3002\u540c\u3058\u5024\u6bb5\u3067\u3084\u3063\u3066\u3082\u3089\u3046\u306e\u304c\u7533\u3057\u8a33\u306a\u3044\u3050\u3089\u3044\u5207\u3063\u3066\u3082\u3089\u3063\u305f\u3002\u307e\u3041\u5148\u5ef6\u3070\u3057\u3057\u3066\u304d\u3066\u9aea\u306e\u6bdb\u304c\u3059\u3054\u3044\u4f38\u3073\u3066\u3084\u3063\u3068\u6563\u9aea\u306b\u3044\u304f\u3068\u3044\u3046\u306e\u306f\u3072\u3069\u3044\u3067\u3059\u304c\u3001\u3057\u304b\u3057\u3059\u3063\u304d\u308a\u3057\u305f\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1598","post","type-post","status-publish","format-standard","hentry","category-computer"],"_links":{"self":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1598"}],"version-history":[{"count":0,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1598\/revisions"}],"wp:attachment":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}