aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillermo Ramos2019-06-28 18:33:22 +0200
committerGuillermo Ramos2019-06-28 18:33:22 +0200
commit90093440e7c406cbd940c6841d92d6ffdae338bc (patch)
tree33a2340a2b27e4a87d1d320d4f9b6b3ce5b532fb
parent105b36ca2c9783fb10f60994be0d93a4f1ad4767 (diff)
downloadtgutils-90093440e7c406cbd940c6841d92d6ffdae338bc.tar.gz
Fix UTF-8 handling in TgLib::Api
-rw-r--r--lib/TgLib/Api.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/TgLib/Api.pm b/lib/TgLib/Api.pm
index 3056073..e643a42 100644
--- a/lib/TgLib/Api.pm
+++ b/lib/TgLib/Api.pm
@@ -31,6 +31,8 @@ sub get_updates {
die $resp->message;
} else {
my $updates = decode_json($resp->content)->{'result'};
+ # TODO why does `decode_json` not do this work?
+ map { utf8::encode($_->{'message'}{'text'}) } @$updates;
$logger->info(sprintf "Received %d updates from chats %s\n",
scalar(@$updates),
join(", ", map { $_->{'message'}{'chat'}{'id'} } @$updates));