Improvements? Did somebody mention improvements??

Andy Bach, Sys. Mangler
Internet: [EMAIL PROTECTED] 
VOICE: (608) 261-5738  FAX 264-5030

Programming is a Dark Art, and it will always be. The programmer is 
fighting against the two most destructive forces in the universe: entropy 
and human stupidity.  -Damian Conway, Perl Guru
----- Forwarded by Andy Bach/WIWB/07/USCOURTS on 11/15/02 09:40 AM -----


saith: "Niels Poppe" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
>
> I figure a lot of people on this list handle UTF-8 and perl :)
>
> What works with URI escaping it?
>
> URI::Escape's &uri_escape fails (miscounts bytes/chars somewhere)
>

If all else fails, the following does work (on either version of
perl).

sub escape {
  join '', map {
    chr($_) =~ /([a-zA-Z0-9_.-])/o? $1 : sprintf "%%%02X", $_
  } unpack 'C*', shift
}

Any improvements are welcome.

Niels

Reply via email to