mirror of
https://github.com/chatmail/core.git
synced 2026-04-22 07:56:29 +03:00
for now make to_string() less strict as we often don't want to crash the whole app just because some non-proper utf8 came in (through a message we can't neccesarily congtrol)
This commit is contained in:
@@ -1561,12 +1561,9 @@ pub fn to_string(s: *const libc::c_char) -> String {
|
||||
let cstr = unsafe { CStr::from_ptr(s) };
|
||||
|
||||
cstr.to_str().map(|s| s.to_string()).unwrap_or_else(|err| {
|
||||
eprintln!(
|
||||
"Non utf8 string: '{:?}' ({:?})",
|
||||
cstr.to_string_lossy(),
|
||||
err
|
||||
);
|
||||
panic!("Non utf8 string: '{:?}' ({:?})", cstr.to_bytes(), err);
|
||||
let lossy = cstr.to_string_lossy();
|
||||
eprintln!("Non utf8 string: '{:?}' ({:?})", lossy, err);
|
||||
lossy.to_string()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user