Skip to content

Commit

Permalink
Merge pull request #248 from luadebug/master
Browse files Browse the repository at this point in the history
Fix UTF8 issues on win
  • Loading branch information
rdbo authored Aug 15, 2024
2 parents 9ae1e03 + ba3eee4 commit 84e6344
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bindings/rust/libmem/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ impl From<lm_module_t> for Module {
base: raw_module.base,
end: raw_module.end,
size: raw_module.size,
path: unsafe { CStr::from_ptr(path_ptr).to_str().unwrap().to_owned() },
name: unsafe { CStr::from_ptr(name_ptr).to_str().unwrap().to_owned() },
path: unsafe {
let bytes = CStr::from_ptr(path_ptr).to_bytes();
String::from_utf8_lossy(bytes).to_string().to_owned()
},
name: unsafe {
let bytes = CStr::from_ptr(name_ptr).to_bytes();
String::from_utf8_lossy(bytes).to_string().to_owned()
},
}
}
}
Expand Down

0 comments on commit 84e6344

Please sign in to comment.