Ton Hospel wrote in perl.perl5.porters :
> Here is a redo of the unpack part of the patches as a result of the
> discussion here. Things of note:
>
> - There is a new unpack format "W" (wide char), an encoding neutral form
> of "C" that's also able to handle char values >= 256
> - All formats are encoding neutral, except "C" which keeps its old
> "just the bytes mam" meaning. (So I also made "c" encoding neutral)
> In practice this seems to do the job of being backward compatible quite
> well (I'd still like to see Encode/MIME/Header.pm use unpack "U0W*"
> instead of unpack "C*", but it isn't needed now)
All these need documentation.
I think we need regression tests for unpack now.
> - I dropped the "length overflow" assertions (didn't want to think up
> something equivalent for utf8), and therefore also dropped the backward
> bug compatible special casing in length calculation for 'p' (that one could
> in principle trigger the assert I think)
> - For the moment I left isSPACE(*s) test when stripping the result of an
> "A" format. I'd like to change that to *s == ' ' since now that we
> support unicode A strings, I don't want to care about all stuff that
> unicode calls "whitespace". It also would make "A" packs more reversible,
> nor was this extended definition of ""space" ever documented. But this
> would be a backward incompatible change and probably needs discussion.
> - The meaning of C0 and U0 are reversed from old perl unpack (and therefore
> now consistent with pack)
> I didn't make W0 an alternative way to switch to C0 mode. Should I ?
I don't see the necessity for it.
Thanks, applied to bleadperl as change #23966, with a tweak :
Mostly due to the safeguards you added, lots of tests failed here with
your original patch :
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
op/pack.t 255 65280 13864 440 3.17% 384-391 2608-2662 2718-2772 2828-
2872 2874-2875 2877-2878 2880-2881
2938-2982 2984-2985 2987-2988 2990-
2991 13755-13864
Either I got undef instead of a value, or things like this :
# Failed at op/pack.t line 574
# got '\'V!\' not supported on this platform at op/pack.t line 569.
# '
# expected ''
So, I removed the error messages, restoring the previous default of doing
nothing if this was not supported. (I didn't touch the new error messages for
j/J though).
Oh, and they need to be added to perldiag :)