develooper Front page | perl.perl5.porters | Postings from May 2023

Small bug in perlunicode.pod?

From:
Martijn Lievaart via perl5-porters
Date:
May 17, 2023 16:53
Subject:
Small bug in perlunicode.pod?
Message ID:
23e1dab6-3006-3ee7-69ba-abf84666e13c@rtij.nl
Hi,


The svUTF8 predictability thread made me reread the perlunicode pod. 
Something caught my eye, "Perls starting in 5.8 have a different Unicode 
model from 5.6." This doesn't seem to match the code examples below it, 
except the last one which seems correct. I think this patch should fix that.


diff --git a/pod/perlunicode.pod b/pod/perlunicode.pod
index 4ddb4c4a30..62d14dd0d7 100644
--- a/pod/perlunicode.pod
+++ b/pod/perlunicode.pod
@@ -2104,7 +2104,7 @@ work under 5.6, so you should be safe to try them out.

  A filehandle that should read or write UTF-8

-  if ($] > 5.008) {
+  if ($] >= 5.008) {
      binmode $fh, ":encoding(UTF-8)";
    }

@@ -2118,7 +2118,7 @@ UTF8 flag is stripped off. Note that at the time 
of this writing
  (January 2012) the mentioned modules are not UTF-8-aware. Please
  check the documentation to verify if this is still true.

-  if ($] > 5.008) {
+  if ($] >= 5.008) {
      require Encode;
      $val = Encode::encode("UTF-8", $val); # make octets
    }
@@ -2130,7 +2130,7 @@ A scalar we got back from an extension
  If you believe the scalar comes back as UTF-8, you will most likely
  want the UTF8 flag restored:

-  if ($] > 5.008) {
+  if ($] >= 5.008) {
      require Encode;
      $val = Encode::decode("UTF-8", $val);
    }
@@ -2139,7 +2139,7 @@ want the UTF8 flag restored:

  Same thing, if you are really sure it is UTF-8

-  if ($] > 5.008) {
+  if ($] >= 5.008) {
      require Encode;
      Encode::_utf8_on($val);
    }


HTH,

M4





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About