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