Hacker News new | ask | show | jobs
by decafbad 2130 days ago
Please stop doing this. Don't bind lower() upper() functions to environment variables or anything else system related. Sun did this in Java and doesn't even bother to mention the issue in documents. It caused huge problems for more than a decade.

You can just make string lowercase() uppercase() function work the same everywhere, regardless of locale settings. Provide a special case function lowercaseTR() or so. This works very well in Go.

By the way, Azerbaijan has the same problem because they accepted help from wrong guys when they switched to Latin.

2 comments

You'll be glad to hear that Python did stop doing this: Python 3 has never behaved this way, and its `lower` and `upper` methods have always been independent of your locale or anything else from your system.

The workaround in the OP was added in 2006 (note the reference to an issue on "SF", i.e. SourceForge -- another era!), and is now long obsolete.

Very much so. Thanks.
> lowercaseTR()

Huh, that works well if we know the input string is in Turkish. What if this information is not available as you're writing the code?

And what will lowercase()/uppercase() be hard coded to do, and what are they supposed to output when the input isn't ASCII?

Give me an example. I'll try to find the best -IMHO- solution.