aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-06-14 10:38:37 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-06-14 10:38:37 +0100
commitafca06d29ca7c5597d6570095b4b352dcc12b9f9 (patch)
tree35c2b3f258809263d31c38994254d59e969853ef /perllib/Open311.pm
parentd9f2c5e76590d56e30a7e5fbaaa388e4addc46a3 (diff)
parentad293e8de86d9911f7031fdd996d235f590c0d15 (diff)
Merge branch 'open311-encode-for-uploads'
Diffstat (limited to 'perllib/Open311.pm')
-rw-r--r--perllib/Open311.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index a902a7213..ebf3ee987 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -8,6 +8,7 @@ use XML::Simple;
use LWP::Simple;
use LWP::UserAgent;
use DateTime::Format::W3CDTF;
+use Encode;
use HTTP::Request::Common qw(GET POST);
use FixMyStreet::Cobrand;
use FixMyStreet::DB;
@@ -495,11 +496,19 @@ sub _request {
my $debug_request = $method . ' ' . $uri->as_string . "\n\n";
my $req = do {
+ $params = {
+ map {
+ my $value = $params->{$_};
+ $_ => ref $value eq 'ARRAY'
+ ? [ map { encode('UTF-8', $_) } @$value ]
+ : encode('UTF-8', $value)
+ } keys %$params
+ };
if ($method eq 'GET') {
$uri->query_form( $params );
GET $uri->as_string;
} elsif ($method eq 'POST') {
- if ($uploads) {
+ if ($uploads && %$uploads) {
# HTTP::Request::Common needs to be constructed slightly
# differently if there are files to upload.