Suggestions on fixing peoples names so they are capitalised correctly
case-sensitive, names, php
Solution
There is no correct way to do this, or to put it more specifically, every method you choose will be wrong.
Sometimes O'Connor will be customarily spelled by its owner as O'connor. Or alternatively someone could have assumed it was O'Connor when it's actually Oconnor, or vice versa. Sometimes McDonald is Mcdonald. You could legally have the name "bob smith", where all the letters are lowercase.
I think the only fix I would do is to change ALL-CAPS to First Letter Capitalization. Otherwise, just leave it alone, because there's no way to distinguish a cruddy speller from someone who decided that they wanted a crazy name.
Problem
Users of our website often type in a lot of garbage for the name and address information. eg, all CAPS, all lower case etc. It looks a lot better if we fix the case for them, but can anyone suggest a good way of doing this. A simple approach is just to capitalise each word in their name, but this fails when dealing with some names. Here are a few examples... - bob mcdonald - sarah o'connor - MR PETE SMITH and here is what I would like to transform them into - Bob McDonald - Sarah O'Connor - Mr Pete Smith I'm using PHP if it helps.