Commit fce7a83
authored
Fix stream did not contain valid UTF-8 (#8120)
## Summary
Related issues: #8009 #7549
Although `PYTHONIOENCODING=utf-8` forces python to use UTF-8 for
`stdout`/`stderr`, it can't prevent code like
`sys.stdout.buffer.write()` or `subprocess.call(["cl.exe", ...])` to
bypass the encoder. This PR uses lossy UTF-8 conversion to avoid
decoding error.
## Alternative
Using `bstr` crate might be better since it can preserve original
information. Or we should follow the Windows convention, unset
`PYTHONIOENCODING` and decode with system default encoding.
## Test Plan
Running locally with non-ASCII character in `UV_CACHE_DIR` works fine,
but I have no unit test plan. Testing locale problem is hard :(1 parent 7bd0d97 commit fce7a83
1 file changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
921 | 921 | | |
922 | 922 | | |
923 | 923 | | |
924 | | - | |
| 924 | + | |
925 | 925 | | |
926 | 926 | | |
927 | 927 | | |
928 | 928 | | |
929 | | - | |
930 | | - | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
931 | 933 | | |
932 | 934 | | |
933 | 935 | | |
| |||
945 | 947 | | |
946 | 948 | | |
947 | 949 | | |
948 | | - | |
| 950 | + | |
949 | 951 | | |
950 | 952 | | |
951 | 953 | | |
| |||
956 | 958 | | |
957 | 959 | | |
958 | 960 | | |
959 | | - | |
960 | | - | |
| 961 | + | |
| 962 | + | |
961 | 963 | | |
962 | 964 | | |
963 | 965 | | |
| |||
0 commit comments