in reply to How to load a + into a string

The string is being sent to a server which then tries to convert it to a DateTime but does not see the + that is expecting

HTTP? Try %2B instead of +. See also Percent-encoding.

Replies are listed 'Best First'.
Re^2: How to load a + into a string
by Wroof (Novice) on Jun 16, 2014 at 21:28 UTC

    Thanks Perlbotics. Yes sorry I forgot to mention that it was via HTTP and once I changed it to %2B it worked perfectly. Also helped me work out a few other bugs in the code. Thanks again.

      Are you sending it via a HTTP GET parameter? The "cleaner" way to do that would be with something like URI:

      use URI; my $uri = URI->new("http://www.foo.com/bar"); $uri->query_form( param_one => "hello+world&foo=bar", param_two => "blah" ); print "$uri\n"; # prints "http://www.foo.com/bar?param_one=hello%2Bworld%26foo%3Dbar&p +aram_two=blah"