diff --git a/src/calibre/ebooks/rtf/input.py b/src/calibre/ebooks/rtf/input.py index fce73668a2..22bb5263d5 100644 --- a/src/calibre/ebooks/rtf/input.py +++ b/src/calibre/ebooks/rtf/input.py @@ -70,7 +70,7 @@ class RTFInput(InputFormatPlugin): self.log = log self.log('Converting RTF to XML...') try: - xml = self.generate_xml(stream) + xml = self.generate_xml(stream.name) except RtfInvalidCodeException: raise ValueError(_('This RTF file has a feature calibre does not ' 'support. Convert it to HTML first and then try it.')) diff --git a/src/calibre/ebooks/rtf/output.py b/src/calibre/ebooks/rtf/output.py index fab7ecad5d..4ef7706762 100644 --- a/src/calibre/ebooks/rtf/output.py +++ b/src/calibre/ebooks/rtf/output.py @@ -30,7 +30,7 @@ class RTFOutput(OutputFormatPlugin): out_stream.seek(0) out_stream.truncate() - out_stream.write(content.encode('cp1252', 'replace')) + out_stream.write(content.encode('ascii', 'replace')) if close: out_stream.close()