Comment by mikestew

Comment by mikestew 20 hours ago

5 replies

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?)

kevin_thibedeau 16 hours ago

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.

  • teo_zero 11 hours ago

    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"...

  • oneshtein 12 hours ago

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

kokada 9 hours ago

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.

thaumasiotes 17 hours ago

> 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?