File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
library/std/src/sys/windows Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use crate::os::windows::io::{FromRawHandle, IntoRawHandle};
77use crate :: ptr;
88use crate :: str;
99use crate :: sys:: c;
10+ use crate :: sys:: compat;
1011use crate :: sys:: cvt;
1112use crate :: sys:: handle:: Handle ;
1213use crate :: sys:: windows:: api;
@@ -201,6 +202,11 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usiz
201202 if written == utf16. len ( ) {
202203 Ok ( utf8. len ( ) )
203204 } else {
205+ if !compat:: is_windows_nt ( ) {
206+ // FIXME: This function should manually convert to the target codepage on 9x/ME, and
207+ // handle incomplete writes by calculating how many utf8-effective bytes were written.
208+ return Ok ( utf8. len ( ) ) ;
209+ }
204210 // Make sure we didn't end up writing only half of a surrogate pair (even though the chance
205211 // is tiny). Because it is not possible for user code to re-slice `data` in such a way that
206212 // a missing surrogate can be produced (and also because of the UTF-8 validation above),
You can’t perform that action at this time.
0 commit comments