I am looking for ways to quickly converting blocks of text created in Word, etc. into plain text (i.e. turning right and left quotation marks into “plain text” quotation marks) for quickly transferring content to code with as few headaches as possible.
I came across this:
…but it is Windows only and I prefer to dev on a Mac. Does anyone have a suggestion for an OSX tool or better yet a web app?
If you’re using Snow Leopard, it’s easy to create a Service to clean text. Run /Applications/Automator, choose the Service template, set it to receive text in any application, and enable replacing the selected text. Add a Run Shell Script action to the workflow, with Pass Input set to stdin. For the actual script, paste this in in place of the template (
LC_CTYPE=en_US.UTF-8 tr '‘’‛❛❜“”‟❝❞‐–—‒‑' "'*5"'"*5-*6'
(note: hopefully all the various funny characters I included in the first string will pass through our various web interfaces intact… if not, edit the collections of quote marks to include whatever you need to squash in the first string, and matching numbers of their plain-text equivalents in the second string. And feel free to add other replacements as needed.)
Anyway, save this Service with some reasonable name, and then to invoke it just select some text (in any Cocoa app — not, unfortunately, MS Word), and select your service from the application menu -> Services submenu. Also, you can use the Keyboard preference pane to assign it a keyboard shortcut if you like.
The “Plain Text” Java application will run on Linux, Mac OS, and Windows.