From 61bea8f9e2f6ef84c0477fd49cf1767890e88826 Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Thu, 21 Apr 2022 16:29:10 +0200 Subject: [PATCH] Handle UTF-8 gracefully --- paste.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paste.pl b/paste.pl index 8103a94..d8b628c 100755 --- a/paste.pl +++ b/paste.pl @@ -58,7 +58,9 @@ get '/.' $c->stash(mtime => POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($stat->mtime))); - $c->stash(file_content => $file->slurp); + my $content = $file->slurp; + $content = Encode::decode('utf-8', $content); + $c->stash(file_content => $content); my $lang = $c->param('ext'); $c->stash(language => "language-$lang"); -- 2.43.5