Avoid signed char-to-int conversions in tolower/toupper calls

These functions document that the arguments must be representable
by `unsigned char`.  In particular, NetBSD is strict about this.

Fixes: #27574
21 files changed