Work around a Python bug on Windows with UTF-8 configuration (#820)