From f2e0eae1e7d9cc73c9a7f7adb7e69ab401c9522c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 17 Nov 2022 09:29:42 +0000 Subject: [PATCH] Bug 32242: Resolve encoding issue when sending to Net::Stomp Content-Type: text/plain; charset=utf-8 This is meant as a quick fix. It should be enhanced later on by letting Net::Stomp do the UTF8 conversion. Test plan: Run batch mod items. Add a Unicode char in the notes. Check if job runs and results are correct. Signed-off-by: Marcel de Rooy --- Koha/BackgroundJob.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm index 442ba77975..e23f8dfa1a 100644 --- a/Koha/BackgroundJob.pm +++ b/Koha/BackgroundJob.pm @@ -137,7 +137,8 @@ sub enqueue { # Also, here we just want the Koha instance's name, but it's not in the config... # Picking a random id (memcached_namespace) from the config my $namespace = C4::Context->config('memcached_namespace'); - $conn->send_with_receipt( { destination => sprintf("/queue/%s-%s", $namespace, $job_queue), body => $json_args } ) + my $encoded_args = Encode::encode_utf8( $json_args ); # FIXME We should better leave this to Net::Stomp? + $conn->send_with_receipt( { destination => sprintf("/queue/%s-%s", $namespace, $job_queue), body => $encoded_args } ) or Koha::Exceptions::Exception->throw('Job has not been enqueued'); } catch { $self->status('failed')->store; -- 2.30.2