on 6/5/02 11:03 PM, [EMAIL PROTECTED] purportedly said:
> Hi people,
>
> I inherited a "legacy" code that contains the
> following line:
>
> return uri_escape( $url,
> '\x00-\x1f\x7f-\xff^&*()$|?<>!\/\\\\\.' ) . $ext;
>
> This code works find under the URI:Escape.pm with a
> CVS version 3.16 2000/08/16.
>
> However, it doesn't work with URI-1.19 in CPAN. I
> checked the source. I got the following error:
>
> uri_escape: Unmatched [ before HERE mark in regex m/([
> << HERE \x00-\x1f\x7f-\xff^&*()$|?<>!\\.\\/ at (eval
> 15) line 1.
>
> I checked the source of both Escape.pm and see that
> the newer one will substitute all / with \\/. So I
> removed the \ before / in the original line and the
> code works for the new URI::Escape.
>
> I am new to URI::Escape. Can someone tell me this
> is a bug or a feature?
Neither really. The writers probably didn't anticipate anyone passing escape
sequences, as they are not only unnecessary but may cause unexpected errors
that are difficult to debug. Instead, you should pass:
"\x00-\x1f\x7f-\xff^&*()$|?<>!/\\."
Note the double quotes, and that you don't need to escape '.' in a character
class. The module should take care of any escaping needed to make the regex
work.
Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"