I don't really like the fact that this function is ASCII only but locale-dependent at the same time, to be honest. I'll suggest doing something ugly and not using tolower - instead using ('a' - 'A') kind of code.