summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2020-03-24 23:23:35 +0100
committerPaweł Redman <pawel.redman@gmail.com>2020-03-24 23:23:35 +0100
commit212ee1427bb1156f637acf3ad6206ad31399a1cf (patch)
tree689d8e35c18175cb1f4b0abb161b3bfcf20f51f6 /testing
parent76405dae0d70ff4fafc3ab0380233ece24855202 (diff)
Handle bad UTF-8 sequences gracefullyHEADmaster
Tremded likes to print weird characters from a random codepage from time to time.
Diffstat (limited to 'testing')
-rw-r--r--testing/log_simulator.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/testing/log_simulator.py b/testing/log_simulator.py
index 8256412..68c5bc9 100644
--- a/testing/log_simulator.py
+++ b/testing/log_simulator.py
@@ -1,4 +1,4 @@
-import time, random
+import sys, time, random
# lipsum.pl
pasta = [
@@ -17,6 +17,8 @@ pasta = [
"Nie muszę państwa przekonywać, że zmiana istniejących kryteriów koliduje z."
]
+sys.stdout.buffer.write(b"Random trash to test invalid UTF-8 sequences: \xde\xad\xbe\xef\n")
+
print("Testing colors: ", end="")
for ch in "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ":
print("^%s%s" % (ch, ch), end="")