{"id":1063,"date":"2017-01-17T22:55:39","date_gmt":"2017-01-17T13:55:39","guid":{"rendered":"http:\/\/randt.jp\/?p=1063"},"modified":"2017-01-17T22:56:55","modified_gmt":"2017-01-17T13:56:55","slug":"haskellutf8%e3%81%b8%e3%81%aeencode","status":"publish","type":"post","link":"https:\/\/randt.jp\/?p=1063","title":{"rendered":"[haskell]UTF8\u3078\u306eencode"},"content":{"rendered":"<p>UTF-8\u3078\u306e\u30a8\u30f3\u30b3\u30fc\u30c9\u306f2\u7a2e\u985e\u3042\u308b\u3002<\/p>\n<pre>\r\nmodule Main (main) where\r\nimport qualified Codec.Binary.UTF8.String as US\r\n\r\nmain = do\r\n\ts < -getContents\r\n\tprint $ US.encode s\r\n\tprint $ US.encodeString s\r\n<\/pre>\n<pre>\r\n$ .\/main \r\n\u3042[227,129,130]\r\n\"\\227\\129\\130\"\r\n<\/pre>\n<pre>\r\nPrelude> :m + Codec.Binary.UTF8.String\r\nPrelude Codec.Binary.UTF8.String> :t encode\r\nencode :: String -> [GHC.Word.Word8]\r\nPrelude Codec.Binary.UTF8.String> :t encodeString\r\nencodeString :: String -> String\r\nPrelude Codec.Binary.UTF8.String> \r\n<\/pre>\n<p>\u3069\u3061\u3089\u3082UTF-8\u306e\u30b3\u30fc\u30c9\u4e26\u3073\u306b\u5909\u63db\u3055\u308c\u308b\u304c\u3001encode\u306fWord8\u3001encodeString\u306fString\u306e\u914d\u5217\u306b\u683c\u7d0d\u3055\u308c\u308b\u3002<\/p>\n<p>\u6700\u521d\u306eString\u306fUnicode\u30b9\u30ab\u30e9\u5024\u3067Unicode\u306e\u6587\u5b57\u96c6\u5408\u5168\u4f53\u3092\u6271\u3048\u308b\u3002encodeString\u306fUTF-8\u306bencode\u3059\u308b\u3051\u308c\u3069\u3001String\u306b\u683c\u7d0d\u3059\u308b\u306e\u306f\u6df7\u4e71\u304c\u3067\u308b\u304b\u306a\u3002\u3067\u304d\u308c\u3070String\u306fUnicode\u30b9\u30ab\u30e9\u5024\u306e\u30af\u30e9\u30b9\u3068\u3057\u3066\u7d71\u4e00\u3057\u3066\u307b\u3057\u3044\u3068\u3053\u308d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UTF-8\u3078\u306e\u30a8\u30f3\u30b3\u30fc\u30c9\u306f2\u7a2e\u985e\u3042\u308b\u3002 module Main (main) where import qualified Codec.Binary.UTF8.String as US main = do s < -ge ...\n\n<p> <a class=\"continue-reading-link\" href=\"https:\/\/randt.jp\/?p=1063\"><span>Continue reading<\/span><i class=\"crycon-right-dir\"><\/i><\/a> <\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[137,19],"tags":[],"class_list":["post-1063","post","type-post","status-publish","format-standard","hentry","category-haskell","category-19"],"_links":{"self":[{"href":"https:\/\/randt.jp\/index.php?rest_route=\/wp\/v2\/posts\/1063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randt.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randt.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randt.jp\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/randt.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1063"}],"version-history":[{"count":1,"href":"https:\/\/randt.jp\/index.php?rest_route=\/wp\/v2\/posts\/1063\/revisions"}],"predecessor-version":[{"id":1064,"href":"https:\/\/randt.jp\/index.php?rest_route=\/wp\/v2\/posts\/1063\/revisions\/1064"}],"wp:attachment":[{"href":"https:\/\/randt.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randt.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randt.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}