Skip to content

Commit

Permalink
Update multi_byte.rs (#86)
Browse files Browse the repository at this point in the history
Under some extreme circumstances, the pre-allocated length might not be sufficient.
  • Loading branch information
dongbin86 authored Sep 8, 2024
1 parent c3f28cb commit 54ca7df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/decoders/charsets/multi_byte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit 54ca7df

Please sign in to comment.