]> www.fi.muni.cz Git - paste.git/blobdiff - paste.pl
Handle UTF-8 gracefully
[paste.git] / paste.pl
index 8103a94b435860acdd76c9239608dfec7999a978..d8b628cc546bc424fe97bd8f26c00659f41e0a07 100755 (executable)
--- a/paste.pl
+++ b/paste.pl
@@ -58,7 +58,9 @@ get '/<filename>.<ext>'
 
        $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");