(keitai-l) Re: tech- acsii to hex conversion for url strings in email

From: Ben Hutchings <ben.hutchings_at_roundpoint.com>
Date: 04/02/01
Message-ID: <JGEMKINHOOBEFEDLJPKOCEGECBAA.ben.hutchings@roundpoint.com>
M. David wrote:
> Does anyone know a simple way to convert ascii text to its hex equivalent 
> in perl?
> 
> imode phones break up url strings in email when it encounters japanese 
> characters- so if you email the string as its hex equivalent its ok.
> eg script.pl?user=%8C%9F%8E%96

This isn't ASCII text, it's Shift-JIS.  This behaviour is quite correct
since URLs aren't allowed to contain characters outside some subset of
ASCII.

This substitution will URL-encode arbitrary bytes for you:
     s/([^\w$-.+!*'(),])/'%'.unpack('H2',$1)/eg;


[ Did you check the archives?   http://www.appelsiini.net/keitai-l/ ]
Received on Mon Apr 2 03:27:25 2001