From: Nicolas Boisselier Date: Sun, 26 Nov 2023 09:17:43 +0000 (+0100) Subject: utf8 X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=a1f83bb6ed080444aed7773ca029cb0805fd8c22;p=nb.git utf8 --- diff --git a/lib/perl/NB/CGI.pm b/lib/perl/NB/CGI.pm index 1dc85381..fa18070b 100644 --- a/lib/perl/NB/CGI.pm +++ b/lib/perl/NB/CGI.pm @@ -1,7 +1,9 @@ +# NB 22.11.23 package NB::CGI; -# NB 22.11.23: TODO use strict; +our $PARAM_UTF8 = 1 unless defined $PARAM_UTF8; use parent qw/CGI/; +&CGI::charset('utf-8') if $CGI::PARAM_UTF8; my $isTextOutput = 0; sub textOutput {{ @@ -79,6 +81,26 @@ sub textOutput {{ }; }} +sub header { + my $status = '200 OK'; + + if (!CGI::nph()) + { + for (my $i=0;$i<@_-1;$i++) + { + next if $_[$i] ne '-status'; + $status = $_[$i+1]; + splice(@_,$i,2); + } + } + my @head = (); + $ENV{SERVER_PROTOCOL} ||= 'HTTP/1.1'; + push @head,$ENV{SERVER_PROTOCOL}." $status\r\n"; + #delete $_->{'status'}; + push @head,CGI::header(@_); + return join('',@head); +} + sub start_html { local $_ = &CGI::start_html(@_); s///s;