3 ms·
https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/ https://www.mjt.me.uk/posts/falsehoods-programmers-believe-a...
by darrenf 2y ago
https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/ https://www.mjt.me.uk/posts/falsehoods-programmers-believe-a...
- mrweasel 2y agoAmazing. For a e-commerce site I argued that we would save ourself a lot of trouble by simply making the address field one large text field, rather than attempt to making a form that would work for every country and city (looking at you Mannheim). But apparently that would make data analysis to complicated.
- bojanz 2y agoThere is a middle ground and some common patterns that can help. The address field names are fairly standardized[0] and Google has an open dataset (used by Chrome and Android) describing which countries need which fields[1]. I have an older PHP library[2] and a newer Go library[3] that build upon this, while crowdsourcing fixes (since Google hasn't updated their dataset in a while). The Go library allows me to serve all address formats and state lists in a single HTTP request, which can then power a very fast JS widget. [0] Initially by the OASIS eXtensible Address Language (xAL) which trickled down into everything from maps to HTML5 autocomplete. [1] https://chromium-i18n.appspot.com/ssl-address https://chromium-i18n.appspot.com/ssl-address [2] https://github.com/commerceguys/addressing https://github.com/commerceguys/addressing [3] https://github.com/bojanz/address https://github.com/bojanz/address