I recently stumbled across one of those bugs that makes you question your code, your operating system, and eventually your choice of profession. The strange part was that it only seemed to happen with the Turkish locale in Windows.
The culprit, as it turned out, was case sensitivity. Both Rick Strahl and Scott Hanselman had already ventured into this particular corner of hell a few months earlier. The Turkish alphabet treats uppercase and lowercase versions of the letter “I” differently from English, which means that innocent-looking assumptions about converting strings can suddenly come back carrying a knife.
The safer approach in C# is to specify the invariant culture:
It’s the sort of bug that works perfectly on your machine right up until your software crosses a border. If you’re feeling brave, switch your browser or system culture to Turkish and see what happens to your code. There’s a decent chance you won’t enjoy the experience. But you might learn something.
Software internationalization is easy to ignore when everyone in the room speaks the same language and uses the same alphabet. Then one day somebody in Istanbul clicks a button and your carefully constructed application falls down the stairs.
The world is a big place. Code accordingly.
Comments
No comments yet.
Leave a reply