Okay, given the following (without all the debugging code I had in
earlier):
# The code that grabs the parameters:
my $qString = $ENV{'QUERY_STRING'};
my @list = split( '&', $qString, 10 );
my %queries = ();
foreach my $pair ( @list )
{ my ( $key, $value ) = split( '=', $pair, 2 );
$key =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
$queries{ $key } = $value;
}
Anyone know why commenting out the transliteration will recover the
shift-JIS characters from the url-encoded stream (leaving spaces as
'+', of course), but leaving the transliteration in will induce the
code to drop shift-JIS lead bytes and every now and then whole
characters?
I had a similar problem with
$value =~ s/\+/ /g;
but it was an intermittent problem. (Haven't tried it today to see
whether it only kills the shift-JIS characters when there is 8-bit
space in the stream, but that may have been what was happening.)
Joel Rees
(waiting for a 3+GHz ARM processor to come out,
to test Steve's willingness to switch again.)