From 1b13f0050302a232a95bcfd04fee3628ecda4091 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Mon, 27 Nov 2017 19:18:00 -0800 Subject: [PATCH] Fix utf8 encoding issue with code-factoids? --- PBot/Factoids.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 0441ac6a..3a4c81c4 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -697,6 +697,11 @@ sub execute_code_factoid_using_vm { $h{'persist-key'} = $self->{factoids}->hash->{$stuff->{channel}}->{$stuff->{keyword}}->{'persist-key'}; } + # not sure why we need this here, but it seems to stop strange + # text encoding issues in the following encode_json call + use Encode; + $h{arguments} = decode('utf8', $h{arguments}); + my $json = encode_json \%h; $stuff->{special} = 'code-factoid';