Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Perl on OSX > interaction bet...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 12 Topic 1019 of 1076
Post > Topic >>

interaction between tr and s (was Re: tr question -- probably wrong list to ask, but ...)

by joel_rees@[EMAIL PROTECTED] (Joel Rees) Dec 1, 2007 at 05:03 PM

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 @[EMAIL PROTECTED]
 = split( '&', $qString, 10 );
> my %queries = ();
> foreach my $pair ( @[EMAIL PROTECTED]
 )
> {	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  
****ft-JIS characters from the url-encoded stream (leaving spaces as  
'+', of course), but leaving the transliteration in will induce the  
code to drop ****ft-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 ****ft-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.)
 




 12 Posts in Topic:
tr question (probably wrong list to ask, but ...)
joel_rees@[EMAIL PROTECTE  2007-12-01 09:33:12 
Re: tr question (probably wrong list to ask, but ...)
andy@[EMAIL PROTECTED] (  2007-12-01 01:56:44 
Re: tr question (probably wrong list to ask, but ...)
douglist@[EMAIL PROTECTED  2007-11-30 19:19:07 
Re: tr question (probably wrong list to ask, but ...)
chas.owens@[EMAIL PROTECT  2007-11-30 21:02:41 
Re: tr question (probably wrong list to ask, but ...)
chas.owens@[EMAIL PROTECT  2007-11-30 21:29:29 
Re: tr question (probably wrong list to ask, but ...)
douglist@[EMAIL PROTECTED  2007-11-30 20:18:12 
Re: tr question (probably wrong list to ask, but ...)
joel_rees@[EMAIL PROTECTE  2007-12-01 11:43:58 
interaction between tr and s (was Re: tr question -- probably wr
joel_rees@[EMAIL PROTECTE  2007-12-01 17:03:23 
Re: interaction between tr and s (was Re: tr question -- probabl
douglist@[EMAIL PROTECTED  2007-12-01 11:59:12 
Re: interaction between tr and s (was Re: tr question -- probabl
joel_rees@[EMAIL PROTECTE  2007-12-03 18:41:33 
Re: tr question (probably wrong list to ask, but ...)
chas.owens@[EMAIL PROTECT  2007-11-30 22:04:08 
Okay, it's not tr after all.
joel_rees@[EMAIL PROTECTE  2007-12-01 12:27:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 0:17:33 CST 2008.