From 16857ea57a7cee642bdfeb020a7405b5522bb378 Mon Sep 17 00:00:00 2001 From: Philip Zembrod Date: Tue, 11 Jan 2022 23:34:29 +0100 Subject: [PATCH] Let fb2fth.py replace zero bytes in block files with a ^@ sequence. Zero bytes in text files can't be handled by at least some editors. --- tools/fb2fth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/fb2fth.py b/tools/fb2fth.py index 5403cad..5493000 100755 --- a/tools/fb2fth.py +++ b/tools/fb2fth.py @@ -15,7 +15,7 @@ def readToString(inFile): while(offset < len(block)): # sys.stderr.write("block %d offset %d\n" % (blockNo, offset)) line = block[offset:offset+64].decode(encoding="cp437") - result.append(line.rstrip()) + result.append(line.rstrip().replace('\0', '^@')) offset += 64 blockNo += 1 return result