X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=public-inbox.cgi;h=3c51c314ebe6c4452e84d8fbd3849357c559456f;hp=9bc3dc2b5477e80b49dce18abd5892c4d8903e7d;hb=e022d3377fd2c50fd9931bf96394728958a90bf3;hpb=89f34da9a510bf87293721942d688b1425bb9cf7 diff --git a/public-inbox.cgi b/public-inbox.cgi index 9bc3dc2b..3c51c314 100755 --- a/public-inbox.cgi +++ b/public-inbox.cgi @@ -12,10 +12,11 @@ use 5.008; use strict; use warnings; -use CGI qw(:cgi :escapeHTML -nosticky); # PSGI/FastCGI/mod_perl compat -use Encode qw(decode_utf8); +use CGI qw(:cgi -nosticky); # PSGI/FastCGI/mod_perl compat +use Encode qw(find_encoding); use PublicInbox::Config; use URI::Escape qw(uri_escape uri_unescape); +my $enc_utf8 = find_encoding('UTF-8'); our $LISTNAME_RE = qr!\A/([\w\.\-]+)!; our $pi_config; BEGIN { @@ -56,7 +57,7 @@ sub main { if ($cgi->request_method !~ /\AGET|HEAD\z/) { return r("405 Method Not Allowed"); } - my $path_info = decode_utf8($cgi->path_info); + my $path_info = $enc_utf8->decode($cgi->path_info); # top-level indices and feeds if ($path_info eq "/") { @@ -213,6 +214,6 @@ sub set_binmode { # no way to validate raw messages, mixed encoding is possible. binmode STDOUT; } else { # strict encoding for HTML and XML - binmode STDOUT, ':encoding(UTF-8)'; + binmode STDOUT, ':encoding(us-ascii)'; } }