Comment by mikestew

1 day ago

When I saw "Turkish alphabet bug", I just knew it was some version of toLower() gone horribly wrong.

(I'm sure there's a good reason, but I find it odd that compiler message tags are invariably uppercase, but in this problem code they lowercased it to go do a lookup from an enum of lowercase names. Why isn't the enum uppercase, like the things you're going to lookup?)

With Turkish you can't safely case-fold with toupper() or tolower() in a C/US locale: i->I and I->i are both wrong. Uppercasing wouldn't work. You have to use Unicode or Latin-5 to manage it.

  • You misunderstood the parent post. They where suggesting to look up the exact string that ends up in the message, without any conversion. So if the message contains INFO, ERROR, etc. then look up "INFO", "ERROR"...

  • It's the bug in the Turkish locale. They hacked Latin alphabet instead of creating a separate letter with separate rules.

Without looking at the source code I think it is because the log functions are lowercase, but I am not sure this is the reason.

> Why isn't the enum uppercase, like the things you're going to lookup?

Another question: why does the log record the string you intended to look up, instead of the string you actually did look up?