in reply to Re: pattern match hangs on malformed UTF-8 input
in thread pattern match hangs on malformed UTF-8 input

I'm telling you the whole story (though obviously some piece of information is missing...
So, here's the output of 'perl -v'. I'm running on RedHat 7.3
This is perl, v5.6.1 built for i686-linux Copyright 1987-2001, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using `man perl' or `perldoc perl'. If you have access to + the Internet, point your browser at http://www.perl.com/, the Perl Home Pa +ge.

The other thing I noticed is in the output you posted, perl sees '>x7 <', while in my output, perl sees '>x <'
Not only that, but the PV is different: 'x\0227 ' vs 'x\227 "\0'. It seems like Perl is treating your input as hex 022 followed by the numeral 7 and a space? Whereas Perl is treating my input as hex 227 followed by a space?

Uh-oh, I figured out the 'g' problem: I had 'use Diagnostics' in there for a while. I pasted my little script in and deleted lines that were commented out and apparently this one wasn't. So, here the exact script and output (still freezes):
$ more tmp.pl #!/usr/local/bin/perl -w use utf8; use Devel::Peek; while (<STDIN>) { print ">$_<\n"; Dump($_); s/\d //; print "hi\n"; } $ printf "x\0227 " | tmp.pl >x < SV = PV(0x80f4b84) at 0x80f4858 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x80ff148 "x\227 "\0 CUR = 4 LEN = 80

Replies are listed 'Best First'.
Re: Re: Re: pattern match hangs on malformed UTF-8 input
by diotalevi (Canon) on May 07, 2003 at 13:53 UTC

    Sorry about the hiatus. I tried your code and it works just fine. Perhaps you should look and see if something unusual has happened to your operating system - perhaps part of perl has just gone bad.

    >x7 < SV = PV(0x743c) at 0x7108 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x8500 "x\0227 "\0 CUR = 5 LEN = 80 hi