factor out .Platform$OS.type == 'windows' as isWindows()
fall back to native encoding on Windows if UTF-8 does not work