# HG changeset patch # User Franz Glasner # Date 1739017879 -3600 # Node ID 48f89d312309c00105412e3ec2b60ad2f50e7e5b # Parent f161448d673efbc5a10e58d4bc995827bee6b340 genpwd: use binary output on Python3 to prevent double encoding diff -r f161448d673e -r 48f89d312309 cutils/genpwd.py --- a/cutils/genpwd.py Sat Feb 08 13:26:39 2025 +0100 +++ b/cutils/genpwd.py Sat Feb 08 13:31:19 2025 +0100 @@ -166,9 +166,13 @@ else: if len(pwd) != opts.req_length: raise AssertionError("internal length mismatch") - if not PY2: - pwd = pwd.decode("iso-8859-15") - print(pwd) + if PY2: + print(pwd) + sys.stdout.flush() + else: + sys.stdout.buffer.write(pwd) + sys.stdout.buffer.write(b'\n') + sys.stdout.buffer.flush() def gen_from_repertoire(length, repertoire):