Clean text copied from a PDF, from Word, or from a web page
A museum label for a ceramic bowl was stored three ways: the designer’s Word file, the PDF that went to the printer, and the sentence on the collection website. A registrar tried to confirm that the website still matched the label. The comparison lit up almost every line. The bowl had not been re-described. The PDF had hyphenated “stoneware” at a line break, the website had turned an apostrophe into a curly quote, and the Word file had a soft hyphen the designer had never typed on purpose.
If you compare before you clean, you review the export. If you clean first, you review the sentence. The order matters more than which comparison tool you open.
What a PDF does at the edge of a line
PDFs are a drawing of a page. A word that did not fit was often split, with a hyphen inserted at the break: “stone-” at the end of one line and “ware” at the start of the next. When you select and copy, that hyphen frequently comes along as a real character. Your paste reads “stone-ware” or “stone- ware” in the middle of a sentence that was never hyphenated in the Word file. A comparison against the original then marks a hyphen that is a typesetting artifact.
The other PDF habit is the missing space. Some files copy as “stonewarebowl” because the space was a gap in the drawing, not a character in the text layer. Other files copy with a line break in the middle of the sentence because each visual line becomes a newline. You get a tall, narrow paste that is one paragraph pretending to be twelve.
Fix the obvious joins before Compare. Search for a hyphen followed by a line break and decide, word by word, whether it was “stoneware” or a real compound like “hand-built.” Do not globally delete every hyphen. The label used “hand-built” on purpose. A global replace will turn that into “handbuilt” and the comparison will then show a change you introduced while cleaning. Rejoin only the words you can see were split because the line ended. Then replace the leftover line breaks inside the paragraph with spaces. On the comparison page, Edit both includes “Replace line breaks with spaces” and “Remove excess white space.” Use those after you have dealt with the real hyphens, and use them on both sides only if both sides need the same bath. If one side is already clean, edit the dirty side in a text editor so you do not scrub the good copy.
What Word hides in a paragraph that looks plain
Word’s curly quotes and curly apostrophes are characters, not a font. The website used a straight apostrophe in “maker’s mark.” Word used a curly one. Character mode marks that one glyph and leaves the rest of the label alone, which is the best case. If you are checking meaning, you can ignore it. If you are checking a catalog that must match byte for byte, you cannot.
Soft hyphens are optional break hints. They are invisible until a copy operation makes them visible or a web page shows a stray hyphen. Non-breaking spaces keep “18 cm” on one line. They survive a paste and then fail a “these should be identical” check against a file that used ordinary spaces. Whitespace and line endings shows how to see those gaps instead of arguing about them.
Text boxes, headers, and comments do not always travel with the paragraph you thought you copied. The registrar copied the label from the body and a colleague copied it from the caption under a photo, which included the credit line. The comparison showed a whole extra sentence. That was not a PDF problem. It was two different selections. Copy from the same place, or paste into a blank document first and delete the credit line before you compare.
What a web page adds
Copying from a browser copies the rendered text, and sometimes more. A “share” widget, a heading that repeats because of the way the template is built, or a line of navigation can sit at the end of the selection. Links may copy as the visible words only, or as the words plus the URL. Superscripts and footnote numbers come along. A zero-width space, used by some sites to control line breaking, pastes as an invisible character that makes two visually identical lines compare as different.
Paste web text into a plain text editor, not into an email, before you paste it into a comparison. Email will helpfully curl the quotes again. In the plain editor, turn on a view that shows spaces and breaks if you have one. Delete any line that is navigation or a button label. Then paste the remainder. If character mode still marks a gap you cannot see, that gap is a character. Delete the characters on either side of the gap and retype the space yourself. Retyping is slower than a global cleanup and it is how you avoid deleting a real accent along with an invisible joiner.
A cleaning order that keeps the bowl’s name intact
Start from the source you trust. For the museum, that was the Word file after the soft hyphens were stripped, not the PDF and not the live page. Make a plain-text copy. Rejoin words that were split only because a line ended. Turn curly quotes into straight quotes only if the destination demands straight quotes. Leave accents alone. “Celadón” should not become “Celadon” because a cleanup script folded accents. Compare the cleaned source with the website paste in word mode. You want highlights that are words a curator changed, such as a date or a donor’s name. You do not want highlights that are hyphens and quotes.
If the first comparison is still a field of punctuation, you are not done cleaning. Do not switch tools yet. The second tool will paint the same hyphens. Remove one class of junk, compare again, and stop when the marks are about the bowl. That is the only difference the registrar needed to send to the person who edits the collection site.