Fix locale handling for input etc. on *nix.

Without this, some input, e.g. compose sequences, could be mangled.

I found that <compose> <apostrophe> <a> was causing ‘Ã¡’ to be input – this
just happens to be the result of conversion from Latin-1 to UTF-8 of ‘á’
when already represented as UTF-8.
Properly fix locale settings.

We mostly use the settings from the environment, except as follows:
* LC_CTYPE – same language/country but with UTF-8 (failing that, "C.UTF-8")
* LC_NUMERIC - "C", due to issues with printf and generated code
Changelog update.