From b9a89e10d63563829a2cbe1eadccbe2844d00eb2 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 12 Mar 2023 18:10:44 -0700 Subject: [PATCH] Fix UTF-8 encoding --- applets/pbot-vm/guest/lib/Languages/_default.pm | 2 +- applets/pbot-vm/host/lib/Languages/_default.pm | 4 ++-- lib/PBot/VERSION.pm | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applets/pbot-vm/guest/lib/Languages/_default.pm b/applets/pbot-vm/guest/lib/Languages/_default.pm index cdb2eaaf..c54bc0af 100755 --- a/applets/pbot-vm/guest/lib/Languages/_default.pm +++ b/applets/pbot-vm/guest/lib/Languages/_default.pm @@ -9,9 +9,9 @@ use warnings; use strict; use IPC::Run qw/run timeout/; +use Encode; use Data::Dumper; - $Data::Dumper::Terse = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Useqq = 1; diff --git a/applets/pbot-vm/host/lib/Languages/_default.pm b/applets/pbot-vm/host/lib/Languages/_default.pm index 18c31608..c870d826 100755 --- a/applets/pbot-vm/host/lib/Languages/_default.pm +++ b/applets/pbot-vm/host/lib/Languages/_default.pm @@ -309,14 +309,14 @@ sub execute { my $result = ""; my $got_result = 0; - while (my $line = <$output>) { - utf8::decode($line); + while (my $line = decode('UTF-8', <$output>)) { $line =~ s/[\r\n]+$//; last if $line =~ /^result:end$/; if ($line =~ /^result:/) { $line =~ s/^result://; + $line = encode('UTF-8', $line); my $octets = decode('UTF-8', $line, sub { sprintf '\\\\x%02X', shift }); $line = encode('UTF-8', $octets, Encode::FB_CROAK); diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index d5c95655..401562d7 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,7 +25,7 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4627, + BUILD_REVISION => 4628, BUILD_DATE => "2023-03-12", };