From 54ca7df6eba7a346f2302cdde9837475a7adc4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=BD=AC?= Date: Mon, 9 Sep 2024 00:18:48 +0800 Subject: [PATCH] Update multi_byte.rs (#86) Under some extreme circumstances, the pre-allocated length might not be sufficient. --- src/decoders/charsets/multi_byte.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decoders/charsets/multi_byte.rs b/src/decoders/charsets/multi_byte.rs index 61c631d..48e0a49 100644 --- a/src/decoders/charsets/multi_byte.rs +++ b/src/decoders/charsets/multi_byte.rs @@ -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.")