From fa09e46ed9bf755f77cfd90dc3de9d7e9b76eaec Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 20 Jul 2019 12:37:51 +0200 Subject: [PATCH] another pace where we might (and in my case did) get invalid utf8 --- src/dc_simplify.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dc_simplify.rs b/src/dc_simplify.rs index bf5162300..45c963e03 100644 --- a/src/dc_simplify.rs +++ b/src/dc_simplify.rs @@ -225,7 +225,8 @@ unsafe fn dc_simplify_simplify_plain_text( pending_linebreaks -= 1 } } - ret += &to_string(line); + // the incoming message might contain invalid UTF8 + ret += &to_string_lossy(line); content_lines_added += 1; pending_linebreaks = 1i32 }