Fix isfoo/tofoo() warnings with Cygwin

Macros like isspace() and tolower() only have defined behavior for
unsigned char values and EOF (-1), but char may be signed
(depending on implementation), potentially passing values from -2 to
-128 to them, which Cygwin deliberately warns of.

Casting to unsigned char guarantees valid results and suppresses most of
the warnings when this is compiled with Cygwin:

    https://www.securecoding.cert.org/confluence/display/seccode/STR37-C.+Arguments+to+character+handling+functions+must+be+representable+as+an+unsigned+char
Guard key_to_dir() from negative key values

Without this, keymap[] could be negatively indexed.
Set width when reading code points in unicode.conf

This suppresses the last warning when compiling with Cygwin.