mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-09 06:18:46 +08:00
Add new script Kirikiri TJS NS0 binary encoded script
This commit is contained in:
@@ -144,6 +144,16 @@ pub fn decode_to_string(
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
Encoding::Utf16LE => Ok(encoding::codec::utf_16::UTF_16LE_ENCODING
|
||||
.decode(
|
||||
data,
|
||||
if check {
|
||||
DecoderTrap::Strict
|
||||
} else {
|
||||
DecoderTrap::Replace
|
||||
},
|
||||
)
|
||||
.map_err(|_| anyhow::anyhow!("Failed to decode UTF-16LE"))?),
|
||||
#[cfg(windows)]
|
||||
Encoding::CodePage(code_page) => Ok(super::encoding_win::decode_to_string(
|
||||
code_page, data, check,
|
||||
@@ -246,6 +256,10 @@ pub fn encode_string(
|
||||
});
|
||||
Ok(result)
|
||||
}
|
||||
Encoding::Utf16LE => {
|
||||
let re = utf16string::WString::<utf16string::LE>::from(data);
|
||||
Ok(re.as_bytes().to_vec())
|
||||
}
|
||||
#[cfg(windows)]
|
||||
Encoding::CodePage(code_page) => {
|
||||
Ok(super::encoding_win::encode_string(code_page, data, check)?)
|
||||
|
||||
Reference in New Issue
Block a user