Commit 1da5acb
os: assume UTF-8 for hostname
Do not assume Latin-1, but rather UTF-8 for the result of getting the
OS hostname.
While in 99 % of cases these strings are stored in ASCII, the OS does
not enforce an encoding on its own, and apparently the hostname is
sometimes set to non-ASCII data (despite at least some versions of
hostname(1) rejecting such input, making it even harder to write a
test for this which would already require root privileges).
In any case, these are short strings, so assuming UTF-8 comes
with no significant overhead.
Fixes: #27848
PR-URL: #27849
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>1 parent e8fa067 commit 1da5acbCopy full SHA for 1da5acb
File tree
Expand file treeCollapse file tree
1 file changed
+10
-3
lines changedOpen diff view settings
Filter options
- src
Expand file treeCollapse file tree
1 file changed
+10
-3
lines changedOpen diff view settings
Collapse file
+10-3Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
49 | 49 | |
50 | 50 | |
51 | 51 | |
| 52 | + |
52 | 53 | |
53 | 54 | |
54 | 55 | |
| ||
69 | 70 | |
70 | 71 | |
71 | 72 | |
72 | | - |
| 73 | + |
| 74 | + |
| 75 | + |
73 | 76 | |
74 | 77 | |
75 | 78 | |
| ||
84 | 87 | |
85 | 88 | |
86 | 89 | |
87 | | - |
| 90 | + |
| 91 | + |
| 92 | + |
88 | 93 | |
89 | 94 | |
90 | 95 | |
| ||
99 | 104 | |
100 | 105 | |
101 | 106 | |
102 | | - |
| 107 | + |
| 108 | + |
| 109 | + |
103 | 110 | |
104 | 111 | |
105 | 112 | |
|
0 commit comments