History

From NUL to DEL: Why 7 Bit ASCII IS Actually Really Clever

Dylan Beattie (05.08.2024)

For the vast majority of folks working in tech these days, ASCII is just part of the fabric of technology: the idea that anybody actually designed it might come as a bit of a shock. But they did, and I think they actually did a really good job. Let’s take a wander through the 7-bit ASCII character set and meet some of my favourite bits.

 

Part 2: Code Pages and Kohuepts: The Chaos of 8 Bit Extended ASCII (12.08.2024)

“But it’s plain text! What do you mean it looks weird?”

Friends, let’s take a walk around the wonderful world of code pages, the cause of more encoding headaches, bizarre punctuation and inventive workarounds than just about anything else in IT history – and along the way, we’ll meet some other things which aren’t really encoding standards, but which have cast their long shadow on the way folks interact with digital data in the age of the World Wide Web.

 

Um die Funktionsweise von CR zu demonstrieren, hat Dylan eine «Progress bar» in C# gezeigt:

Console.WriteLine("Progress bar demo using carriage returns");
const int STEPS = 40;
const string SPINNER = "|/-\\";
var random = new Random();
for (var i = 0; i <= STEPS; i++) {
	Console.Write("\r");
	Console.Write("Progress: ");
	Console.Write(SPINNER[i%4]);
	Console.Write(" [");
	Console.Write(String.Empty.PadRight(i, '▓').PadRight(STEPS, ' '));
	Console.Write("]");
	Thread.Sleep(TimeSpan.FromMilliseconds(random.Next(200)));
}
Console.WriteLine();
Console.WriteLine("All done!");

Da ich selber momentan keine Möglichkeit habe C# auszuführen, habe ich ChatGPT um eine Übersetzung in Python gebeten:

import sys
import time
import random

print("Progress bar demo using carriage returns")
STEPS = 40
SPINNER = "|/-\\"

for i in range(STEPS + 1):
    sys.stdout.write("\r")  # Carriage return to overwrite the line
    sys.stdout.write("Progress: ")
    sys.stdout.write(SPINNER[i % 4])
    sys.stdout.write(" [")
    sys.stdout.write("▓" * i + " " * (STEPS - i))
    sys.stdout.write("]")
    sys.stdout.flush()
    time.sleep(random.uniform(0.2, 0.4))  # Random sleep between 200ms and 400ms

print()  # Move to the next line
print("All done!")
To top