Recently I’ve been running into a lot of silliness that appears in files exported from MS applications (Word, Excel, etc.) called ‘Smart quotes’.
Basically MS uses higher level ascii characters to represent quotes that mean more than regular quotes (whatever for?!). You see this weirdness in vi as <93><92> etc. which are the hex values of these characters. I had to hunt a bunch on google to find out how to fix this, although the fix is very easy.
For each value that you see in your file, just do a string substitution, like so:
of course, you can’t just type that <93> in there, so to get it in there you use (via: http://www.vim.org/htmldoc/usr_45.html)
CTRL-V x 93
which inserts hex 93 in place.
In recently exported CSV’s from excel, I’ve seen hex 91-97.
Quite annoying, frankly.
You could also use perl, like here
perl -pi -e”s/\x92/’/g” myfile.html
and use it on multiple files.
Blogged with Flock