diff --git a/src/input_common.rs b/src/input_common.rs index 4162b8312..5d9b954df 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -1019,15 +1019,15 @@ fn parse_codepoint( return ControlFlow::Continue(true); } let mut codepoint = u32::from(res); - let sz = unsafe { + match unsafe { mbrtowc( std::ptr::addr_of_mut!(codepoint), std::ptr::addr_of!(read_byte).cast(), 1, state, ) - } as isize; - match sz { + } as isize + { -1 => { FLOG!(reader, "Illegal input"); *consumed += 1; @@ -1038,12 +1038,6 @@ fn parse_codepoint( // Sequence not yet complete. return ControlFlow::Continue(false); } - 0 => { - // Actual nul char. - *consumed += 1; - out_seq.push('\0'); - return ControlFlow::Continue(true); - } _ => (), } if let Some(res) = char::from_u32(codepoint) {