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

From: Renfield Kuroda <Renfield.Kuroda_at_morganstanley.com>
Date: 04/02/01
Message-ID: <3AC7BA8B.279CB95B@morganstanley.com>
"M. David" wrote:
> 
> Mika,
> 
> Thanks for the code, with a few changes so that it can be used on a url-
> 
> $hex_str = unpack("H32",  $asc_str);
> $hex_str =~ s/(..)/ $1/g;
> $hex_str =~ s/ /%/g;
> 
> am i right in assuming there are 2 characters for each 1 in regular ascii?


Not necessarily. Japanese might have single-byte ascii mixed in. Best to
check for high bytes to determine if a byte is part of a 2-byte
character or not. Or better yet use jcode.pl.

r e n


-- 
ascii:	r	e	n	f	i	e	l	d
octal:	\162	\145	\156	\146	\151	\145	\154	\144
hex:	\x72	\x65	\x6e	\x66	\x69	\x65	\x6c 	\x64
morgan stanley dean witter japan
e-business technologies | engineering and strategy

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