Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Unrelated to the fundamental issue (a part of your pipeline generates invalid CSV), I would never store the name of the country like this. The country's name is "The Republic of Moldova" and I would store it like this.

Sure, the most common collation scheme for country names is to sort ignoring certain prefixes like "The Republic of", "The", "People's Democratic...", etc. but this is purely a presentation layer issue (how to order a list of countries to a user) that should be independent of your underlying data.

Sure "hacking" the name of the country like this to make the traditional alphabetical ordering match a particular ordering desired to aid human navigation has a lot of history (encyclopedia indexes, library indexes, record stores, etc.) but that was in the age of paper and physical filing systems.

Store the country name correctly and then provide a custom sort or multiple custom sorts where such functionality belongs - in the presentation layer.



While true, the default and naive sort of anything is alphabetical, and you'd need to implement this more advanced nondefault sort in every possible client.

Personally I've never seen any sort where "The Republic of Moldova" would be sorted at "M".


It's reasonably common to sort by a either a short form of the name or the ISO code or similar, with the full name being displayed by the list.

This sometimes causes problems for the UK, which can be sorted as U, G, B, or even E (presumably for "England", making it especially annoying for people in the other countries of the UK).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: