Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
226 views
in Technique[技术] by (71.8m points)

python - Replace Unicode characters with ASCII characters in a text file

I used Foxit PDF Reader to convert a PDF file to a TXT file. Most of the text is straightforwardly readable. A few symbols are not, depending on what software I use to view the file. Some characters were non-ASCII in the PDF file, such as N-dashes and ligatures for "fl" and "fi". My question is how to replace these with characters that are readable no matter which text editor or word processor one uses. For example, the byte sequence E2 80 93 represents an N-dash. I would like to replace this with a hyphen wherever it occurs in the TXT file. Is there a way of doing this in Python? Is there a hex editor that can do this? [Edited 24 Jan 2021:] I have found that UltraEdit can be used to do what I am trying to do straightforwardly. It suits my purposes. Thanks for the replies.

question from:https://stackoverflow.com/questions/65850434/replace-unicode-characters-with-ascii-characters-in-a-text-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...