in reply to Re^33: Interleaving bytes in a string quickly
in thread Interleaving bytes in a string quickly

that's just a bug in Perl.

No, it's quite intentional.

If anything, the warning is seen as the bug.

  • Comment on Re^34: Interleaving bytes in a string quickly

Replies are listed 'Best First'.
Re^35: Interleaving bytes in a string quickly
by BrowserUk (Patriarch) on Mar 01, 2010 at 18:08 UTC
    No, it's quite intentional.

    For what purpose?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Whatever purpose you want, not just unicode strings.

      That makes no sense at all. It breaks everything:

      pp \$a;; [Malformed UTF-8 character (fatal) at C:/Perl64/lib/Data/Dump.pm line +458, <STDIN> line 13. print unpack 'H*', $a;; Malformed UTF-8 character (byte 0xfe) in unpack at (eval 21) line 1, < +STDIN> line 14. Malformed UTF-8 character (unexpected continuation byte 0x84, with no +preceding start byte) in unpack Malformed UTF-8 character (unexpected continuation byte 0x80, with no +preceding start byte) in unpack Malformed UTF-8 character (unexpected continuation byte 0x80, with no +preceding start byte) in unpack Malformed UTF-8 character (unexpected continuation byte 0x80, with no +preceding start byte) in unpack Malformed UTF-8 character (unexpected continuation byte 0x80, with no +preceding start byte) in unpack Malformed UTF-8 character (unexpected continuation byte 0x80, with no +preceding start byte) in unpack 4100000000000000

      And perl already has a perfectly good mechanism for packing integers into strings.

      It also means that you now have a mechanism that will allow you to construct a string of packed integers that Perl has no way of unambiguously deconstructing.

      I look forward to seeing that deperecated & removed sometime soon.

      And it has no bearing upon the original desicussion because SvPVbytes() wouldn't know what to do with it either.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        unpack 'H' requires bytes. Well, pretty much all of unpack does. That's the point. Just like interleave does.

        Note that it properly handles both string formats:

        $ perl -wle'$x="\x80"; for (1..2) { print unpack "H*", $x; utf8::upgra +de($x); }' 80 80

        It also means that you now have a mechanism that will allow you to construct a string of packed integers that Perl has no way of unambiguously deconstructing.

        I don't understand this at all.