perl-unicode

Re: chr(0xFFFF_FFFF) and "\x{10_FFFF}"

1998-10-23 13:13:36
Gisle Aas writes:
: I am sitting here writing some test suite scripts for utf8.pm.  I hope
: somebody is able to fix bugs as fast I can find them :-)
: 
: First two bugs I found:
: 
: chr() seems to get things wrong for values bigger than 0x7FFF_FFFF.
: Probably some signed/unsigned issue.
: 
:   $ perl -Mutf8 -le 'print unpack("H*", chr(0x7FFF_FFFF))'
:   fdbfbfbfbfbf
:   $ perl -Mutf8 -le 'print unpack("H*", chr(0x8FFF_FFFF))'
:   ff

The patch for this one is

*** pp.c.orig   Fri Oct 23 12:57:45 1998
--- pp.c        Fri Oct 23 12:57:49 1998
***************
*** 2146,2152 ****
  {
      djSP; dTARGET;
      char *tmps;
!     I32 value = POPi;
  
      (void)SvUPGRADE(TARG,SVt_PV);
  
--- 2146,2152 ----
  {
      djSP; dTARGET;
      char *tmps;
!     U32 value = POPu;
  
      (void)SvUPGRADE(TARG,SVt_PV);
  
Larry

<Prev in Thread] Current Thread [Next in Thread>