diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index 206a18b3e4..546d3f1842 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -103,7 +103,7 @@ def separate_paragraphs_print_formatted(txt): return txt def preserve_spaces(txt): - txt = txt.replace(' ', ' ') + txt = re.sub('(?P[ ]{2,})', lambda mo: ' ' + (' ' * (len(mo.group('space')) - 1)), txt) txt = txt.replace('\t', '    ') return txt