Update multi_byte.rs (#86)

Under some extreme circumstances, the pre-allocated length might not be sufficient.
This commit is contained in:
董彬
2024-09-08 18:18:48 +02:00
committed by GitHub
parent c3f28cb4d1
commit 54ca7df6eb
+1 -1
View File
@@ -14,7 +14,7 @@ use encoding_rs::*;
#[cfg(feature = "full_encoding")]
fn multi_byte_decoder(mut decoder: Decoder, bytes: &[u8]) -> String {
let mut result = String::with_capacity(bytes.len() * 3);
let mut result = String::with_capacity(bytes.len() * 4);
if let (CoderResult::OutputFull, _, _) = decoder.decode_to_string(bytes, &mut result, true) {
debug_assert!(false, "String full while decoding.")