{"id":814,"date":"2010-10-22T17:10:40","date_gmt":"2010-10-22T08:10:40","guid":{"rendered":"http:\/\/peta.okechan.net\/blog\/?p=814"},"modified":"2010-10-22T17:10:40","modified_gmt":"2010-10-22T08:10:40","slug":"tornado%e3%81%af%e3%83%aa%e3%82%af%e3%82%a8%e3%82%b9%e3%83%88%e3%83%8f%e3%83%b3%e3%83%89%e3%83%a9%e3%81%ab%e3%83%91%e3%83%a9%e3%83%a1%e3%83%bc%e3%82%bf%e3%82%92%e6%b8%a1%e3%81%99%e5%89%8d%e3%81%abunqu","status":"publish","type":"post","link":"https:\/\/peta.okechan.net\/blog\/archives\/814","title":{"rendered":"Tornado\u306f\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30e9\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3059\u524d\u306bunquote\u3057\u3066\u308b"},"content":{"rendered":"<p>Tornado\u3092\u4f7f\u3063\u3066\u305f\u3089\u3001URL\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30a8\u30b9\u30b1\u30fc\u30d7\uff0f\u30a2\u30f3\u30a8\u30b9\u30b1\u30fc\u30d7\u5468\u308a\u3067\u4e0d\u53ef\u89e3\u306a\u6319\u52d5\u304c\u3042\u3063\u305f\u305f\u3081\u3001\u30bd\u30fc\u30b9\u3092\u8aad\u3093\u3067\u307f\u305f\u3089\u30bf\u30a4\u30c8\u30eb\u306e\u901a\u308a\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30e9\u306b\u6e21\u3059\u524d\u306bunquote\u3059\u308b\u4f5c\u308a\u306b\u306a\u3063\u3066\u307e\u3057\u305f\uff08\u30d0\u30fc\u30b8\u30e7\u30f31.1 \uff09\u3002<br \/>\n\u30bd\u30fc\u30b9\u304c\u77ed\u3044\u304b\u3089\u8aad\u307f\u3084\u3059\u304f\u3066\u30a4\u30a4\u3002<\/p>\n<p>\u4e0d\u53ef\u89e3\u306a\u6319\u52d5\u3068\u3044\u3046\u306e\u306f\u3001Tornado\u3067\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067URL\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u51fa\u529b\u3059\u308b\u969b\u3001url_escape\u3068\u3044\u3046\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u95a2\u6570\u3092\u4f7f\u3063\u3066\u30a8\u30b9\u30b1\u30fc\u30d7\u3059\u308b\u306e\u304c\u666e\u901a\u3060\u3068\u601d\u3046\u306e\u3067\u3059\u304c\u3001url_escape\u306f\u5185\u90e8\u3067urllib.quote_plus\u3092\u4f7f\u3063\u3066\u308b\u3093\u3067\u3059\u306d\u3002<br \/>\n\u3064\u307e\u308a\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30e9\u5185\u3067\u306f\u3001\u5143\u306e\u6587\u5b57\u5217\u3092quote_plus\u3057\u305f\u3082\u306e\u3092unquote\u3057\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308b\u308f\u3051\u3067\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u3068\u300c+\u300d\u8a18\u53f7\u304c\u5165\u3063\u3066\u308b\u3068\u304a\u304b\u3057\u306a\u4e8b\u306b\u306a\u308b\u8a33\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070 u&#8221;ai+u eo&#8221; \u3068\u3044\u3046\u6587\u5b57\u5217\u3092quote_plus\u3059\u308b\u3068 u&#8221;ai%2Bu+eo&#8221; \u3068\u306a\u308a\u307e\u3059\u3002\u305d\u308c\u3092unquote\u3059\u308b\u3068%2B\u306f\u5143\u306b\u623b\u3057\u3066\u304f\u308c\u307e\u3059\u304c\u3001\u300c+\u300d\u8a18\u53f7\u306f\u5143\u306b\u623b\u3057\u3066\u304f\u308c\u306a\u3044\u305f\u3081 u&#8221;ai+u+eo&#8221; \u3068\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u3053\u3053\u307e\u3067\u6765\u3066\u3057\u307e\u3046\u3068\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30e9\u5185\u3060\u3051\u3067\u306f\u3082\u3046\u5143\u306e\u6587\u5b57\u5217\u3092\u6b63\u78ba\u306b\u518d\u73fe\u3059\u308b\u8853\u304c\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u3069\u30fc\u3059\u3093\u306e\u3088\u30b3\u30ecw<\/p>\n<p>\u30b3\u30ec\u306e\u89e3\u6c7a\u65b9\u6cd5\u306f\u3001<br \/>\n1. \u30b9\u30da\u30fc\u30b9\u3092\u5225\u306e\u6587\u5b57\u306b\u7f6e\u63db\u3057\u3066\u304b\u3089quote_plus\u3001unquote\u3055\u308c\u3066\u304d\u305f\u30e2\u30ce\u3092\u30cf\u30f3\u30c9\u30e9\u5185\u3067\u5fa9\u5143\u3059\u308b\u3002<br \/>\n2. 1\u3068\u540c\u3058\u3088\u3046\u306a\u65b9\u6cd5\u3067\u3001quote_plus\u3057\u3066\u3055\u3089\u306bquote\u3059\u308b\u3002unquote\u3055\u308c\u3066\u304d\u305f\u30e2\u30ce\u3092\u30cf\u30f3\u30c9\u30e9\u5185\u3067unquote_plus\u3059\u308b\u3002<br \/>\n3. tornado\/web.py\u3092\u3044\u3058\u3063\u3066\u52dd\u624b\u306bunquote\u3057\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u3002\u3082\u3057\u304f\u306funquote_plus\u306b\u3059\u308b\u3002<br \/>\n4. tornado.escape.url_escape\u3067quote_plus\u3058\u3083\u306a\u304f\u3066quote\u3092\u4f7f\u3046\u3088\u3046\u306b\u3059\u308b\u3002<br \/>\n\u3068\u3044\u30464\u30d1\u30bf\u30fc\u30f3\u3092\u601d\u3044\u3064\u304d\u307e\u3057\u305f\u3002<br \/>\n\u4e00\u756a\u30b9\u30de\u30fc\u30c8\u305d\u3046\u306a4\u3092\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>tornado\/escape.py \u3092\u76f4\u63a5\u3044\u3058\u308b\u306e\u306f\u30a2\u30ec\u306a\u306e\u3067\u3001tornado web\u30b5\u30fc\u30d0\u30fc\u8d77\u52d5\u6642\u306b\u5fc5\u305a\u8aad\u307f\u8fbc\u307e\u308c\u308b\u30e2\u30b8\u30e5\u30fc\u30eb\u5185\u306b\u4ee5\u4e0b\u3092\u8a18\u8ff0\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport urllib\r\nfrom tornado import escape\r\n\r\ndef url_escape(value, quote_plus = True):\r\n\t&quot;&quot;&quot;Returns a valid URL-encoded version of the given value.&quot;&quot;&quot;\r\n\tif quote_plus:\r\n\t\treturn urllib.quote_plus(escape.utf8(value))\r\n\t# quote\u306f\u30c7\u30d5\u30a9\u3067'\/'\u3092\u30af\u30aa\u30fc\u30c8\u3057\u306a\u3044\u305f\u3081\u7b2c\u4e8c\u5f15\u6570\u306b\u7a7a\u6587\u5b57\u3092\u6e21\u3057\u3066\u5168\u90e8\u30af\u30aa\u30fc\u30c8\u3059\u308b\u3088\u3046\u306b\u3059\u308b\r\n\treturn urllib.quote(escape.utf8(value), '')\r\n\r\ndef url_unescape(value, unquote_plus = True):\r\n\t&quot;&quot;&quot;Decodes the given value from a URL.&quot;&quot;&quot;\r\n\tif unquote_plus:\r\n\t\treturn escape._unicode(urllib.unquote_plus(value))\r\n\treturn escape._unicode(urllib.unquote(value))\r\nescape.url_escape = url_escape\r\nescape.url_unescape = url_unescape\r\n<\/pre>\n<p>\u95a2\u6570\u306e\u3059\u308a\u66ff\u3048\u304c\u7c21\u5358\u306a\u306e\u3067\u697d\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u3067\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067 url_escape(text, False) \u3068\u3057\u3066\u4f7f\u3046\u3068\u3001\u3044\u3044\u611f\u3058\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30e9\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u6e21\u3063\u3066\u304d\u307e\u3059\u3002<br \/>\n\u6ce8\u610f\u70b9\u306f\u3001web.py\u3067unquote\u3055\u308c\u308b\u6642\u306funicode\u5316\u3055\u308c\u306a\u3044\u306e\u3067\u5fc5\u8981\u306a\u3089\u30cf\u30f3\u30c9\u30e9\u5185\u3067unicode\u5316\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u30b3\u30e1\u30f3\u30c8\u3067\u66f8\u3044\u3066\u307e\u3059\u304c\u3001quote\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u300c\/\u300d\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u306a\u3044\u306e\u3067\u7b2c\u4e8c\u5f15\u6570\u3092\u7a7a\u6587\u5b57\u306b\u3057\u3066\u3001quote_plus\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306b\u5408\u308f\u305b\u3066\u3042\u308a\u307e\u3059\u3002<br \/>\n\uff08quote_plus \u3068 quote \u306f\u7a7a\u767d\u3092\u3069\u3046\u7f6e\u304d\u63db\u3048\u308b\u304b\u4ee5\u5916\u306b\u3082\u3069\u306e\u6587\u5b57\u3092\u7f6e\u304d\u63db\u3048\u308b\u304b\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u9055\u3044\u307e\u3059\uff01\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tornado\u3092\u4f7f\u3063\u3066\u305f\u3089\u3001URL\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30a8\u30b9\u30b1\u30fc\u30d7\uff0f\u30a2\u30f3\u30a8\u30b9\u30b1\u30fc\u30d7\u5468\u308a\u3067\u4e0d\u53ef\u89e3\u306a\u6319\u52d5\u304c\u3042\u3063\u305f\u305f\u3081\u3001\u30bd\u30fc\u30b9\u3092\u8aad\u3093\u3067\u307f\u305f\u3089\u30bf\u30a4\u30c8\u30eb\u306e\u901a\u308a\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30e9\u306b\u6e21\u3059\u524d\u306bunquote\u3059\u308b\u4f5c\u308a\u306b\u306a\u3063\u3066\u307e\u3057\u305f\uff08\u30d0\u30fc\u30b8\u30e7\u30f31.1 \uff09\u3002<br \/>\n\u30bd\u30fc\u30b9\u304c\u77ed\u3044\u304b\u3089\u8aad\u307f\u3084\u3059\u304f\u3066\u30a4\u30a4\u3002<\/p>\n<p>\u4e0d\u53ef\u89e3\u306a\u6319\u52d5\u3068\u3044\u3046\u306e\u306f\u3001Tornado\u3067\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067URL\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u51fa\u529b\u3059\u308b\u969b\u3001url_escape\u3068\u3044\u3046\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u95a2\u6570\u3092\u4f7f\u3063\u3066\u30a8\u30b9\u30b1\u30fc\u30d7\u3059\u308b\u306e\u304c\u666e\u901a\u3060\u3068\u601d\u3046\u306e\u3067\u3059\u304c\u3001url_escape\u306f\u5185\u90e8\u3067urllib.quote_plus\u3092\u4f7f\u3063\u3066\u308b\u3093\u3067\u3059\u306d\u3002<br \/>\n\u3064\u307e\u308a\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30e9\u5185\u3067\u306f\u3001\u5143\u306e\u6587\u5b57\u5217\u3092quote_plus\u3057\u305f\u3082\u306e\u3092unquote\u3057\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308b\u308f\u3051\u3067\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u3068\u300c+\u300d\u8a18\u53f7\u304c\u5165\u3063\u3066\u308b\u3068\u304a\u304b\u3057\u306a\u4e8b\u306b\u306a\u308b\u8a33\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070 u&#8221;ai+u eo&#8221; \u3068\u3044\u3046\u6587\u5b57\u5217\u3092quote_plus\u3059\u308b\u3068 u&#8221;ai%2Bu+eo&#8221; \u3068\u306a\u308a\u307e\u3059\u3002\u305d\u308c\u3092unquote\u3059\u308b\u3068%2B\u306f\u5143\u306b\u623b\u3057\u3066\u304f\u308c\u307e\u3059\u304c\u3001\u300c+\u300d\u8a18\u53f7\u306f\u5143\u306b\u623b\u3057\u3066\u304f\u308c\u306a\u3044\u305f\u3081 u&#8221;ai+u+eo&#8221; \u3068\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u3053\u3053\u307e\u3067\u6765\u3066\u3057\u307e\u3046\u3068\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30e9\u5185\u3060\u3051\u3067\u306f\u3082\u3046\u5143\u306e\u6587\u5b57\u5217\u3092\u6b63\u78ba\u306b\u518d\u73fe\u3059\u308b\u8853\u304c\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u3069\u30fc\u3059\u3093\u306e\u3088\u30b3\u30ecw<\/p>\n<p>\u30b3\u30ec\u306e\u89e3\u6c7a\u65b9\u6cd5\u306f\u3001<br \/>\n1. \u30b9\u30da\u30fc\u30b9\u3092\u5225\u306e\u6587\u5b57\u306b\u7f6e\u63db\u3057\u3066\u304b\u3089quote_plus\u3001unquote\u3055\u308c\u3066\u304d\u305f\u30e2\u30ce\u3092\u30cf\u30f3\u30c9\u30e9\u5185\u3067\u5fa9\u5143\u3059\u308b\u3002<br \/>\n2. 1\u3068\u540c\u3058\u3088\u3046\u306a\u65b9\u6cd5\u3067\u3001quote_plus\u3057\u3066\u3055\u3089\u306bquote\u3059\u308b\u3002unquote\u3055\u308c\u3066\u304d\u305f\u30e2\u30ce\u3092\u30cf\u30f3\u30c9\u30e9\u5185\u3067unquote_plus\u3059\u308b\u3002<br \/>\n3. tornado\/web.py\u3092\u3044\u3058\u3063\u3066\u52dd\u624b\u306bunquote\u3057\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u3002\u3082\u3057\u304f\u306funquote_plus\u306b\u3059\u308b\u3002<br \/>\n4. tornado.escape.url_escape\u3067quote_plus\u3058\u3083\u306a\u304f\u3066quote\u3092\u4f7f\u3046\u3088\u3046\u306b\u3059\u308b\u3002<br \/>\n\u3068\u3044\u30464\u30d1\u30bf\u30fc\u30f3\u3092\u601d\u3044\u3064\u304d\u307e\u3057\u305f\u3002<br \/>\n\u4e00\u756a\u30b9\u30de\u30fc\u30c8\u305d\u3046\u306a4\u3092\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>tornado\/escape.py \u3092\u76f4\u63a5\u3044\u3058\u308b\u306e\u306f\u30a2\u30ec\u306a\u306e\u3067\u3001tornado web\u30b5\u30fc\u30d0\u30fc\u8d77\u52d5\u6642\u306b\u5fc5\u305a\u8aad\u307f\u8fbc\u307e\u308c\u308b\u30e2\u30b8\u30e5\u30fc\u30eb\u5185\u306b\u4ee5\u4e0b\u3092\u8a18\u8ff0\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport urllib\r\nfrom tornado import escape\r\n\r\ndef url_escape(value, quote_plus = True):\r\n\t&quot;&quot;&quot;Returns a valid URL-encoded version of the given value.&quot;&quot;&quot;\r\n\tif quote_plus:\r\n\t\treturn urllib.quote_plus(escape.utf8(value))\r\n\t# quote\u306f\u30c7\u30d5\u30a9\u3067'\/'\u3092\u30af\u30aa\u30fc\u30c8\u3057\u306a\u3044\u305f\u3081\u7b2c\u4e8c\u5f15\u6570\u306b\u7a7a\u6587\u5b57\u3092\u6e21\u3057\u3066\u5168\u90e8\u30af\u30aa\u30fc\u30c8\u3059\u308b\u3088\u3046\u306b\u3059\u308b\r\n\treturn urllib.quote(escape.utf8(value), '')\r\n\r\ndef url_unescape(value, unquote_plus = True):\r\n\t&quot;&quot;&quot;Decodes the given value from a URL.&quot;&quot;&quot;\r\n\tif unquote_plus:\r\n\t\treturn escape._unicode(urllib.unquote_plus(value))\r\n\treturn escape._unicode(urllib.unquote(value))\r\nescape.url_escape = url_escape\r\nescape.url_unescape = url_unescape\r\n<\/pre>\n<p>\u95a2\u6570\u306e\u3059\u308a\u66ff\u3048\u304c\u7c21\u5358\u306a\u306e\u3067\u697d\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u3067\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067 url_escape(text, False) \u3068\u3057\u3066\u4f7f\u3046\u3068\u3001\u3044\u3044\u611f\u3058\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u30cf\u30f3\u30c9\u30e9\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u6e21\u3063\u3066\u304d\u307e\u3059\u3002<br \/>\n\u6ce8\u610f\u70b9\u306f\u3001web.py\u3067unquote\u3055\u308c\u308b\u6642\u306funicode\u5316\u3055\u308c\u306a\u3044\u306e\u3067\u5fc5\u8981\u306a\u3089\u30cf\u30f3\u30c9\u30e9\u5185\u3067unicode\u5316\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u30b3\u30e1\u30f3\u30c8\u3067\u66f8\u3044\u3066\u307e\u3059\u304c\u3001quote\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u300c\/\u300d\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u306a\u3044\u306e\u3067\u7b2c\u4e8c\u5f15\u6570\u3092\u7a7a\u6587\u5b57\u306b\u3057\u3066\u3001quote_plus\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306b\u5408\u308f\u305b\u3066\u3042\u308a\u307e\u3059\u3002<br \/>\n\uff08quote_plus \u3068 quote \u306f\u7a7a\u767d\u3092\u3069\u3046\u7f6e\u304d\u63db\u3048\u308b\u304b\u4ee5\u5916\u306b\u3082\u3069\u306e\u6587\u5b57\u3092\u7f6e\u304d\u63db\u3048\u308b\u304b\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u9055\u3044\u307e\u3059\uff01\uff09<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[60,353],"class_list":["post-814","post","type-post","status-publish","format-standard","hentry","category-tech","tag-python","tag-tornado"],"_links":{"self":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/comments?post=814"}],"version-history":[{"count":0,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/814\/revisions"}],"wp:attachment":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/media?parent=814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/categories?post=814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/tags?post=814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}