A whole load of UTF-8/-16 confusion fixes for Windows.