{"id":1711,"date":"2011-09-30T13:44:44","date_gmt":"2011-09-30T20:44:44","guid":{"rendered":"http:\/\/home.khris.net\/?p=1711"},"modified":"2011-09-30T13:59:07","modified_gmt":"2011-09-30T20:59:07","slug":"%d0%bf%d1%80%d0%be%d1%87%d1%82%d0%b8%d1%82%d0%b5-%d0%b6%d0%b5-%d0%bd%d0%b0%d0%ba%d0%be%d0%bd%d0%b5%d1%86-%d0%b8%d0%bd%d1%81%d1%82%d1%80%d1%83%d0%ba%d1%86%d0%b8%d1%8e","status":"publish","type":"post","link":"https:\/\/home.khris.net\/?p=1711","title":{"rendered":"&#8230;\u043f\u0440\u043e\u0447\u0442\u0438\u0442\u0435 \u0436\u0435, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e&#8230;"},"content":{"rendered":"<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 Eclipse \u0440\u0435\u0448\u0438\u043b\u0430\u0441\u044c. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u0441 Eclipse \u0431\u044b\u043b\u0430:<br \/>\n<code><br \/>\n<a href=\"http:\/\/ahinea.com\/en\/tech\/perl-unicode-struggle.html\">http:\/\/ahinea.com\/en\/tech\/perl-unicode-struggle.html<\/a><br \/>\nSolution #2: Specify IO encoding layers for your filehandles<\/p>\n<p>In Perl 5.8 a filehandle can have an encoding specified for it.  Perl then will convert all input from the file automatically into its internal Unicode encoding.  It will mark the values read from it accordingly with the utf8 flag.  Equally, perl can convert output to a specific encoding for a filehandle.  Additionally, perl checks that the data you output is valid for the filehandle\u2019s encoding.<\/p>\n<p>So, if you read data from a file or another input stream, and you expect UTF-8 data there, warn perl:<\/p>\n<p>    if ( <strong>open( FILE, \"<:utf8 \", $fname )<\/strong> ) {<br \/>\n      . . .<br \/>\n    }<\/p>\n<p>or, in case of our simple test,<\/p>\n<p>    #!\/usr\/bin\/perl<\/p>\n<p>    my $ustring1 = \"Hello \\x{263A}!\\n\";<br \/>\n    binmode DATA, \":utf8\";<br \/>\n    my $ustring2 = <data>;<\/p>\n<p>    print \"$ustring1$ustring2\";<br \/>\n    __DATA__<br \/>\n    Hello \u263a!<br \/>\n<\/data><\/:utf8><\/strong><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 Eclipse \u0440\u0435\u0448\u0438\u043b\u0430\u0441\u044c. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u0441 Eclipse \u0431\u044b\u043b\u0430: http:\/\/ahinea.com\/en\/tech\/perl-unicode-struggle.html Solution #2: Specify IO encoding layers for your filehandles In Perl 5.8 a filehandle can have an encoding specified for it. Perl then will convert all input from the file automatically into its internal Unicode encoding. It will mark the values read from it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"close","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[18],"_links":{"self":[{"href":"https:\/\/home.khris.net\/index.php?rest_route=\/wp\/v2\/posts\/1711"}],"collection":[{"href":"https:\/\/home.khris.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/home.khris.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/home.khris.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/home.khris.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1711"}],"version-history":[{"count":5,"href":"https:\/\/home.khris.net\/index.php?rest_route=\/wp\/v2\/posts\/1711\/revisions"}],"predecessor-version":[{"id":1715,"href":"https:\/\/home.khris.net\/index.php?rest_route=\/wp\/v2\/posts\/1711\/revisions\/1715"}],"wp:attachment":[{"href":"https:\/\/home.khris.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/home.khris.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/home.khris.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}