From 730f510e2441257a1ea61822c76b2dd779fcb3c8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 26 Nov 2010 08:57:03 -0700 Subject: [PATCH] RTF Output: Handle non-breakinf spaces correctly. Fixes #7668 (HTML to RTF (Non Breaking Space) v0.7.29) --- src/calibre/ebooks/rtf/rtfml.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/rtf/rtfml.py b/src/calibre/ebooks/rtf/rtfml.py index 53ba7ecbd8..5aa4979b04 100644 --- a/src/calibre/ebooks/rtf/rtfml.py +++ b/src/calibre/ebooks/rtf/rtfml.py @@ -81,7 +81,9 @@ def txt2rtf(text): buf = cStringIO.StringIO() for x in text: val = ord(x) - if val <= 127: + if val == 160: + buf.write('\\~') + elif val <= 127: buf.write(x) else: repl = ascii_text(x)