misc fixes
This is a collection of misc fixes that I did while working on !243 (merged). Some were reviewed there already. Shouldn't be anything controversial.
Some fixes address issues with non-ASCII filenames when the system encoding is set to LANG=C
or ANSI
(e.g. default when unset).
This will also happen for people using ISO8869-1
encoding and they encounter extended UTF-8
or say the various Chinese, Japanese, Burmese, etc. encodings that were hugely popular before they started moving to Unicode.