PDF를 텍스트로 줄이기 위해 PDFminer의 pdf2text를 사용했습니다. 불행히도 특수 문자가 포함되어 있습니다. 내 콘솔파이썬 : 나를 (PDFminer에서) 문제를주는 특수 문자
>>>a=pdf_to_text("ap.pdf")
을 heres
그것의 샘플을 조금 잘린
>>>a[5000:5500]
'f one architect. Decades ...... but to re\xef\xac\x82ect\none set of design ideas, than to have one that contains many\ngood but independent and uncoordinated ideas.\n1 Joshua Bloch, \xe2\x80\x9cHow to Design a Good API and Why It Matters\xe2\x80\x9d, G......=-3733'
내가 그것을
>>>a[5000:5500].encode('utf-8')
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 237: ordinal not in range(128)
내가 조금 주위에 검색 인코딩해야 함을 이해하고 출력을 보여 드리죠 그들을 시도했다, 특히 Replace special characters in python. 입력은 PDFminer에서 비롯되어 힘든 (AFAIK) 컨트롤입니다. 적절한 출력 방법은 무엇입니까 일반 텍스트?
내가 뭘 잘못하고 있니?
--A 빠른 수정 : ASCII-하는 PDFminer의 코덱을 변경할 수 있지만,이 코덱을 변경 답변 -에 대한 지속적인 solution--
--Abandoned 빠른 수정이 아니다는 제거 정보 -
맥심 http://en.wikipedia.org/wiki/Windows-1251에서 언급 한 바와 같이--A relavent 주제 - 비 ASCII 문자가 str
객체에 저장 될 때
감사합니다! 파이썬에서 임베디드 초보자는 어쩌면 데모 코드를 게시하여이 오류가 문제가되지 않도록 Pdfminer를 사용할 수 있습니까? 감사합니다 –