Address formats
Posted on 18 Jun 2009 at 11:48
Simon Jones tackles the tricky subject of handling addresses in applications, both within the UK and far beyond.
This month, I've been battling with the validation and formatting of street addresses. A customer of ours runs a business that deals with people in the UK and around the world, and this firm needs to capture addresses and send letters to all those people. While it's tempting just to provide users of your software with a single large box into which they can type the recipient's address, doing it this way is to throw away much information that would have been invaluable for sorting and selecting people based on their location. Say you wanted to invite all the people you know in Manchester to a seminar - if all your address data was entered via that single field then you'd have difficulty separating people who live in Manchester city in the UK from those who live at Manchester Road, Southport and those who live in Manchester, New Hampshire, USA; a simple text search wouldn't distinguish between these. You could search for people with a postcode in their address field, in which the postcode is an "M" followed by one or two digits, but that might also erroneously take in residents of the Isle of Man whose postcodes start "IM" followed by one or two digits, or indeed those around Romford, Essex where the postcodes start "RM". The fact is that despite the extra difficulty it imposes on the programmers, and the extra discipline on the users, it's better to separate every address into distinct fields at entry stage.
A UK postal address should consist of three parts: a postcode, a post town and everything else is the street address. The Royal Mail doesn't want you to put the county name in a postal address, because there are far too many instances where the street address lies in one county but the post town is in another. For instance, large parts of Wales have their post sorted and delivered from across the border in England, so postcodes that start "SY" are centred on Shrewsbury but may cover Shropshire, Cheshire, Dyfed and Powys.
Elsewhere in the world, the different national postal authorities have different rules as to what's desirable in an address. In the US, for example, they like to have the state name abbreviation as well as the "city" and "ZIP code" just to check that they're delivering to the right place. (One of the reasons The Simpsons were situated in "Springfield" is that more than half of US states have a town of that name.) Some countries that consist of several islands, such as New Zealand and Japan, want the name of the town and the island as well as the country. Other countries have deeper subdivisions such as France's Départements, Germany's Lande and many countries' districts. The names of such subdivisions vary and sometimes need to be included in the address and sometimes excluded, so if you're building a system that will work for worldwide addresses, you need to capture: Street address; Post town/City; County/State/D???©partement/Lande/Island/District or whatever; Postcode/ZIP code/Postal zone; Country. The street address may span multiple lines, whereas all the other items are single lines.
Each national postal authority lays out rules as to how addresses should be formatted to aid delivery of post, and all these rules are gathered together by the Universal Postal Union (UPU) - part of the United Nations - which acts as the forum for cooperation between national postal services. UPU publishes these rules on its website at www.pcpro/links/177advoff. On that website you can look up a country and see how it would like addresses to be presented. Some countries offer only a small example, leaving you to guess which lines of the example correspond with which parts of the address, while others specify that there must be no more than N lines in an address, that it must be right-aligned, that the font must be monospaced and between X and Y points.
Simon Jones
Simon is a contributing editor to PC Pro. He's an independent IT consultant specialising in Microsoft Office, Visual Basic and SQL Server.
advertisement
- Getting to grips with Microsoft's IT Health Environment Scanner
- Virtualise your servers
- The changing face of travel gadgets
- Build your own distributed file system
- The bulletproof Dell that costs an arm and a leg
- Microsoft Office 2010 Technical Preview: Q&A
- Lawnmowers, the TyTN II and one odd insurance request
- There'll never be a bulletproof OS
- How far can we trust apps?
- Five nice touches in Outlook 2010
- Need a bit of extra Christmas cash? Grass up your boss, says BSA
- Photoshop Mobile on Android review: first look
- ATI Radeon HD 5970: 42% more expensive in the UK
- Office 2010 Beta – 32-bit or 64-bit – The Choice is Clear
- Why Britain's watchdogs have fewer teeth than goldfish
- Tabbed documents: how to make Office 2010 great
- Outlook 2010 People Pane – does it spell death to Xobni
- Microsoft Outlook 2010 screenshots
- Co-Authoring in Word 2010 and SharePoint Foundation 2010
- Microsoft Outlook 2010 screenshots: Backstage view
- Kindle update brings native PDF support
- Lenovo launches first ever ThinkCentre all-in-one PC
- Average mobile broadband speed only 0.87Mbits/sec
- iPhone hitting Tesco in time for Christmas
- Gmail adds offline attachments
- Mobile data surges up by 16% in October
- OFT: Google isn't harming consumers
- £90 million buys South Yorkshire 25Mbits/sec broadband
- Twitter ready to splash out... and run ads
- LogMeIn Express offers fuss-free screen sharing
advertisement
Printed from www.pcpro.co.uk


