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 }}");
header('Content-Type: text/plain');
header('Content-Type: text/plain; charset=utf-8');
echo('OK');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,6 +6,6 @@ permalink: /cgi/uptime/
$uptime = shell_exec('uptime');
$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);
?>

View file

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