Fix for bad locale entry in lib/misc.zsh

LC_CTYPE was being set to $LANG, which is bad because
1. LANG expects a list, and LC_CTYPE expects a single value.
2. LC_CTYPE can be set by the environment at a different value than LANG, to cope with non-ASCII applications in a Latin environment, mainly for Asian languages.

It now checks if it is set by the environment, and if not picks the first entry of LANG or a safe default.