{"id":3379,"date":"2014-02-26T20:00:55","date_gmt":"2014-02-26T19:00:55","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/Hayek\/Jochen\/wp\/blog-en\/?p=3379"},"modified":"2014-02-26T20:00:55","modified_gmt":"2014-02-26T19:00:55","slug":"perl-encode-different-checks-unexpected-result","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2014\/02\/26\/perl-encode-different-checks-unexpected-result\/","title":{"rendered":"Perl&#8217;s Encode.pm: calling encode differently on the same encoding handle does not yield the expected result"},"content":{"rendered":"<p>\t\t\t\tI have a scenario, where I call encode on the same encoding handle a couple of times and with different values for CHECK.<\/p>\n<p>Initially I just used\u00a0<em>encode<\/em>\u00a0with a coderef for CHECK, because that lets me handle replacement situations best.<\/p>\n<p>Then I had to enhance the code with a pre-check on the replacement character: So I run <em>encode<\/em> with FB_CROAK for CHECK w\/o considering the result, just checking for an exception resp. $@.<\/p>\n<p>But this 1st run of encode has a disturbing impact on the further runs of encode &#8212; they w<span style=\"line-height: 1.5\">on&#8217;t run as expected with that 1st check in place. <\/span><\/p>\n<p><span style=\"line-height: 1.5\">W\/o that 1st check, everything is fine.<\/span><\/p>\n<p><span style=\"line-height: 1.5\">If I replace the 1st check with another coderef for CHECK, everything is fine again.<\/span><\/p>\n<p>That rather worries me.\t\t\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a scenario, where I call encode on the same encoding handle a couple of times and with different values for CHECK. Initially I just used\u00a0encode\u00a0with a coderef for CHECK, because that lets me handle replacement situations best. Then I had to enhance the code with a pre-check on the replacement character: So I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[666],"tags":[],"class_list":["post-3379","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-Sv","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/3379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=3379"}],"version-history":[{"count":0,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/3379\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=3379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=3379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=3379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}