pdf2txt: do not double encode stdout
parent
28c2a4e6ad
commit
0a2d90c051
|
@ -164,7 +164,9 @@ class TextConverter(PDFConverter):
|
|||
return
|
||||
|
||||
def write_text(self, text):
|
||||
self.outfp.write(text.encode(self.codec, 'ignore'))
|
||||
if self.codec:
|
||||
text = text.encode(self.codec, 'ignore')
|
||||
self.outfp.write(text)
|
||||
return
|
||||
|
||||
def receive_layout(self, ltpage):
|
||||
|
|
|
@ -85,6 +85,8 @@ def main(argv):
|
|||
outfp = open(outfile, 'wb')
|
||||
else:
|
||||
outfp = sys.stdout
|
||||
if outfp.encoding is not None:
|
||||
codec = None
|
||||
if outtype == 'text':
|
||||
device = TextConverter(rsrcmgr, outfp, codec=codec, laparams=laparams,
|
||||
imagewriter=imagewriter)
|
||||
|
|
Loading…
Reference in New Issue