← Back

Not so smart quotes

I've had a bit of a headache just recently, converting an MS Access database to a MySQL one. I used a helpful little tool called dataloader on a virtual machine to get the mysql dump out but smart quotes and other characters outside of the standard ascii set didn't import correctly into mysql. In fact, it just truncated the contents of that field an the point that it encountered the offending character.

I've messed about trying to search and replace things with sed and similar but I haven't got the time to be messing around writing a script to do it. As a result, I've just used the Vim editor to do a find and replace of the ones that have affected me.

Here's a list of a few search/replace commands that have sorted me out today:

%s/\%x91/\‘/g
%s/\%x92/\’/g
%s/\%x93/\“/g
%s/\%x94/\”/g
%s/\%x95/\•/g
%s/\%x96/\–/g
%s/\%x97/\—/g
%s/\%x85/\…/g

Hope it helps someone out.