diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2019-07-16 12:37:45 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-07-16 13:03:40 +0200 |
commit | 28c93ce4af25750b721e2dcaebb1864d509edd32 (patch) | |
tree | dc899c7b9c7bfaea9fa9a465017acc310d261f98 | |
parent | d7a682fdede536dd95f76425ac9e06faf334199c (diff) | |
download | meson-28c93ce4af25750b721e2dcaebb1864d509edd32.zip meson-28c93ce4af25750b721e2dcaebb1864d509edd32.tar.gz meson-28c93ce4af25750b721e2dcaebb1864d509edd32.tar.bz2 |
work around failure of test 185 in single-byte locales
The Windows CI runs with codepage 1252, which is basically ISO-8859-1 and does not
have a mapping for character U+0151 (Å‘). It is currently passing because of a
happy accident, as the generator command line is emitted in UTF-8 anyway
(starting at commit 6089631a, "Open build files with utf-8", 2018-04-17, which
however lacks documentation or history) and file.py treats it as two
single-byte characters.
When going through meson_exe, however, Windows passes a genuine Unicode
character via CreateProcessW and file.py fails to decode it, so we need to
pass errors='replace' when opening the output file.
On Windows, the test is then fixed. On POSIX systems it is _still_ passing as
a happy accident because (according to the current locale) the output file
contains two single-byte characters rather than the single Unicode character
"Å‘"; in fact, if one modifies the ninja backend to use force_serialize=True,
meson_exe fails to build the command line for file.py and stops with a
UnicodeEncodeError.
-rw-r--r-- | test cases/common/185 escape and unicode/file.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test cases/common/185 escape and unicode/file.py b/test cases/common/185 escape and unicode/file.py index af67a09..40fa7ca 100644 --- a/test cases/common/185 escape and unicode/file.py +++ b/test cases/common/185 escape and unicode/file.py @@ -6,5 +6,5 @@ import os with open(sys.argv[1]) as fh: content = fh.read().replace("{NAME}", sys.argv[2]) -with open(os.path.join(sys.argv[3]), 'w') as fh: +with open(os.path.join(sys.argv[3]), 'w', errors='replace') as fh: fh.write(content) |