Even though that project is long in the past for me, I’m really curious how other people do this. Anyone come up with something better?
Even though that project is long in the past for me, I’m really curious how other people do this. Anyone come up with something better?
You can also lean on various APIs to normalize, but nothing that I'm aware of does this well on a global scale.
That is quite an assumption.
I personally would use a field with a structured format e.g. XML (most RDBMS systems can deal with XML easily) and different types of address field e.g. postcode, zip code etc.
Then you could use a strategy for each country when dealing with it in your application.
I've always gone the other way. Bland fields (Lines 1-4, city, state, postcode, country) or - when I didn't need to validate it, a textarea for free form entry.
Most of the time validation has been required by the shipping provider, so freeform hasn't been possible. As the shipping providers haven't got anything 'better', we stick to their format and field lengths (which are terrible for out-of-country addresses)