mirror of
https://github.com/isar/rusqlite.git
synced 2025-09-16 12:42:18 +08:00
Use String::from_utf8_lossy for error/trace.
Try to use the original message even if there are invalid characters.
This commit is contained in:
@@ -101,8 +101,7 @@ pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
unsafe fn errmsg_to_string(errmsg: *const c_char) -> String {
|
||||
let c_slice = CStr::from_ptr(errmsg).to_bytes();
|
||||
let utf8_str = str::from_utf8(c_slice);
|
||||
utf8_str.unwrap_or("Invalid string encoding").to_owned()
|
||||
String::from_utf8_lossy(c_slice).into_owned()
|
||||
}
|
||||
|
||||
fn str_to_cstring(s: &str) -> Result<CString> {
|
||||
|
Reference in New Issue
Block a user