Skip to content

Commit e6ebca6

Browse files
committed
final fix
1 parent 20a9f46 commit e6ebca6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pe/resource.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ pub(super) fn to_utf16_string(bytes: &[u8]) -> Option<String> {
2525
.map(|chunk| u16::from_le_bytes([chunk[0], chunk[1]]))
2626
.take_while(|&wchar| wchar != 0)
2727
.collect::<Vec<_>>();
28-
Some(String::from_utf16_lossy(&u16_chars))
28+
String::from_utf16(&u16_chars).ok()
2929
}
3030

3131
/// Helper for parsing `wchar_t` utf-16 strings in a safe manner.
3232
#[derive(Debug, Copy, Clone, Default, PartialEq)]
33-
pub struct Utf16String<'a>(&'a [u8]);
33+
pub(crate) struct Utf16String<'a>(&'a [u8]);
3434

3535
impl<'a> Utf16String<'a> {
3636
/// Converts underlying bytes into an owned [String].

0 commit comments

Comments
 (0)