File tree 1 file changed +6
-0
lines changed
library/std/src/sys/windows
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};
7
7
use crate :: ptr;
8
8
use crate :: str;
9
9
use crate :: sys:: c;
10
+ use crate :: sys:: compat;
10
11
use crate :: sys:: cvt;
11
12
use crate :: sys:: handle:: Handle ;
12
13
use crate :: sys:: windows:: api;
@@ -201,6 +202,11 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usiz
201
202
if written == utf16. len ( ) {
202
203
Ok ( utf8. len ( ) )
203
204
} 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
+ }
204
210
// Make sure we didn't end up writing only half of a surrogate pair (even though the chance
205
211
// is tiny). Because it is not possible for user code to re-slice `data` in such a way that
206
212
// 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