http://www.perlmonks.org?node_id=74402

iguane has asked for the wisdom of the Perl Monks concerning the following question:

In the module URI::Escape, it seems to have a problem. In fact when i try to do :
print uri_escape ( '~' ) ;
the return value is the same ~ bit normaly it must be %7E .
But the reverse code  print uri_unescape ( '%7E' ) ; give the correct value ~.
Is somebody have seem the same problem ?
Thanks

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: Probably problem with uri_escape ?
by merlyn (Sage) on Apr 21, 2001 at 17:05 UTC
    The tilde has been relaxed in recent HTTP specifications to no longer need escaping, and the LWP library was updated to reflect that. In general, you'll never need to specify a collection of characters to uri_escape. It does the right standard thing.
Re: Probably problem with uri_escape ?
by arhuman (Vicar) on Apr 21, 2001 at 13:09 UTC
    From perldoc URI::Escape :
    The uri_escape() function takes an optional second argument that overrides the set of characters that are to be escaped. The set is specified as a string that can be used in a regular expression character class (between [ ]). E.g.: "\x00-\x1f\x7f-\xff" # all control and hi-bit ch +aracters "a-z" # all lower case characters "^A-Za-z" # everything not a letter
    I think you should explicitely specify the set of character to be encoded...