Monday, May 18, 2009

Cut and paste between word and csh/ksh

Symptom Brief Description: Single quotes become periods when copied from Word to a csh/ksh session.

Here's another issue that briefly made me nuts.

Cutting and pasting commands between a Word document and a ksh or csh session resulted in single quotes being rendered as periods.

Things that are totally not the cause:
I wasted time assuming it was a unicode issue, even dropping it to notepad, messing around with the encoding, and running it through dos2unix. Do not bother with this! It is *much* more simple than that.

The actual problem:
Word Autocorrect will, by default, replace straight single quotes with smart quotes as you type. This is a problem for ksh or csh and results in them being interpreted as periods.

How to fix it:
To switch off autoformat for smartquotes:
  • Go to 'File', ‘word options’, ‘autocorrect’, ‘autoformat as you type’
  • Uncheck “replace straight quotes with smart quotes”

Any new documents will now default to straight quotes.

To fix existing documents:
  • Highlight one of the smart quotes
  • Hit ctrl-c to get it into the clipboard
  • Hit ctrl-h to bring up find and replace
  • Hit ctrl-v to enter the smart quote in the 'Find' box
  • Enter a straight quote in the 'Replace With' box
  • Hit 'Replace All' to fix them all at once, or if you only want to replace examples of commands, iterate through each.

No comments:

Post a Comment