Added charset to HTTP header output.

This commit is contained in:
Johannes Findeisen 2024-02-17 00:56:59 +01:00
commit 56199acc2f
15 changed files with 19 additions and 21 deletions

View file

@ -8,6 +8,6 @@ session_set_cookie_params({{ site.lifetime }});
date_default_timezone_set("{{ site.timezone }}"); date_default_timezone_set("{{ site.timezone }}");
header('Content-Type: text/plain'); header('Content-Type: text/plain; charset=utf-8');
echo('OK'); echo('OK');

View file

@ -2,7 +2,7 @@
permalink: /cgi/bash/index.sh permalink: /cgi/bash/index.sh
--- ---
echo "Content-type: text/plain" echo "Content-type: text/plain; charset=utf-8"
echo echo
echo "Hello from bash!" echo "Hello from bash!"
echo echo

View file

@ -22,6 +22,6 @@ $_SESSION["two"] = rand(0, 9);
$challenge = $_SESSION["one"] . " + " . $_SESSION["two"]; $challenge = $_SESSION["one"] . " + " . $_SESSION["two"];
header('Content-Type: text/plain'); header('Content-Type: text/plain; charset=utf-8');
echo($challenge); echo($challenge);
?> ?>

View file

@ -2,7 +2,7 @@
permalink: /cgi/gitlog/index.sh permalink: /cgi/gitlog/index.sh
--- ---
echo "Content-type: text/plain" echo "Content-type: text/plain; charset=utf-8"
echo echo
cat {{ site.document_root }}/gitlog.html cat {{ site.document_root }}/gitlog.html

View file

@ -13,6 +13,6 @@ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['REMOTE_ADDR']; $ip = $_SERVER['REMOTE_ADDR'];
} }
header('Content-Type: text/plain'); header('Content-Type: text/plain; charset=utf-8');
echo($ip); echo($ip);
?> ?>

View file

@ -2,7 +2,7 @@
permalink: /cgi/lua/index.lua permalink: /cgi/lua/index.lua
--- ---
print("Content-type: text/plain") print("Content-type: text/plain; charset=utf-8")
print() print()
print("Hello from Lua!") print("Hello from Lua!")
print() print()

View file

@ -37,7 +37,7 @@ if ($_POST["sum"] == $sum) {
unset($_SESSION["two"]); unset($_SESSION["two"]);
} }
header('Content-Type: text/plain'); header('Content-Type: text/plain; charset=utf-8');
if ($error=="") { if ($error=="") {
echo("{{ site.mail_thank_you }}"); echo("{{ site.mail_thank_you }}");
} else { } else {

View file

@ -6,13 +6,11 @@ use warnings;
use strict; use strict;
use POSIX qw(strftime); use POSIX qw(strftime);
my $date = strftime "%m/%d/%Y", localtime; print("Content-type: text/plain; charset=utf-8\n\n");
print("Hello from Perl!\n\n");
print("Content-type: text/plain\n\n"); print("print(strftime('%m/%d/%Y %Z', localtime));\n");
print "Hello from Perl!\n\n"; print(strftime("%m/%d/%Y %Z", localtime));
print $date; print("\n\n");
print "\n\n";
print('my @i = (1..10); for(@i) { print("$_", "\n"); }'); print('my @i = (1..10); for(@i) { print("$_", "\n"); }');
print("\n"); print("\n");

View file

@ -4,7 +4,7 @@ permalink: /cgi/php/index.php
<?php <?php
header('Content-Type: text/plain'); header('Content-Type: text/plain; charset=utf-8');
echo('Hello from PHP!'); echo('Hello from PHP!');
echo("\n\n"); echo("\n\n");

View file

@ -6,7 +6,7 @@ from datetime import datetime
#from http import HTTPStatus #from http import HTTPStatus
#from pprint import pprint #from pprint import pprint
print("Content-type: text/plain\n") print("Content-type: text/plain; charset=utf-8\n")
#print(HTTPStatus.OK.value) #print(HTTPStatus.OK.value)
print("Hello from Python!") print("Hello from Python!")
print("") print("")

View file

@ -2,7 +2,7 @@
permalink: /cgi/ruby/index.rb permalink: /cgi/ruby/index.rb
--- ---
puts('Content-type: text/plain') puts('Content-type: text/plain; charset=utf-8')
puts puts
puts('Hello from Ruby!') puts('Hello from Ruby!')
puts puts

View file

@ -14,6 +14,6 @@ $milliseconds = floor(microtime(true) * 1000);
#echo($timestamp . "_" . time() . "_" . $milliseconds); #echo($timestamp . "_" . time() . "_" . $milliseconds);
header('Content-Type: text/plain'); header('Content-Type: text/plain; charset=utf-8');
echo($timestamp . '.' . microtime(true)); echo($timestamp . '.' . microtime(true));
?> ?>

View file

@ -9,6 +9,6 @@ $pos = strpos($uname, '-', 0);
$res = substr($uname, 0, $pos); $res = substr($uname, 0, $pos);
header('Content-Type: text/plain'); header('Content-Type: text/plain; charset=utf-8');
echo($res); echo($res);
?> ?>

View file

@ -6,6 +6,6 @@ permalink: /cgi/uptime/
$uptime = shell_exec('uptime'); $uptime = shell_exec('uptime');
$version = shell_exec('uptime -V'); $version = shell_exec('uptime -V');
header('Content-Type: text/plain'); header('Content-Type: text/plain; charset=utf-8');
echo('Server ' . substr($version, 0, -1) . ': ' . $uptime); echo('Server ' . substr($version, 0, -1) . ': ' . $uptime);
?> ?>

View file

@ -24,6 +24,6 @@ $cmd = 'whois ' . $host;
$whois = shell_exec($cmd); $whois = shell_exec($cmd);
header('Content-Type: text/plain'); header('Content-Type: text/plain; charset=utf-8');
echo($whois); echo($whois);
?> ?>