Commit 796cd68
committed
fix(ls): use GetACP to detect UTF-8 encoding on Windows
On Windows, locale environment variables (LC_ALL, LC_COLLATE, LANG)
are typically unset, causing get_locale_from_env() to default to
UEncoding::Ascii. This makes non-ASCII filenames display as octal
escape sequences or `?` characters in ls output.
Fix by querying the system ANSI code page via GetACP() when no locale
variables are set. If the active code page is 65001 (UTF-8), use
UEncoding::Utf8. This aligns with GNU coreutils' gnulib approach
which calls locale_charset() -> GetACP() on Windows.
Fixes: #111031 parent 5605eac commit 796cd68
1 file changed
Lines changed: 30 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
31 | 49 | | |
32 | 50 | | |
33 | 51 | | |
| |||
70 | 88 | | |
71 | 89 | | |
72 | 90 | | |
73 | | - | |
74 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
75 | 103 | | |
76 | 104 | | |
77 | 105 | | |
| |||
0 commit comments