applets/swkbd: Fix text check message encoding
The text check message can be encoded in UTF-8.
This commit is contained in:
parent
1af499c15b
commit
3af2117c88
@ -278,13 +278,21 @@ void SoftwareKeyboard::ProcessTextCheck() {
|
||||
|
||||
std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck));
|
||||
|
||||
std::u16string text_check_message =
|
||||
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure ||
|
||||
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm
|
||||
? Common::UTF16StringFromFixedZeroTerminatedBuffer(
|
||||
swkbd_text_check.text_check_message.data(),
|
||||
swkbd_text_check.text_check_message.size())
|
||||
: u"";
|
||||
std::u16string text_check_message = [this, &swkbd_text_check]() -> std::u16string {
|
||||
if (swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure ||
|
||||
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm) {
|
||||
return swkbd_config_common.use_utf8
|
||||
? Common::UTF8ToUTF16(Common::StringFromFixedZeroTerminatedBuffer(
|
||||
reinterpret_cast<const char*>(
|
||||
swkbd_text_check.text_check_message.data()),
|
||||
swkbd_text_check.text_check_message.size() * sizeof(char16_t)))
|
||||
: Common::UTF16StringFromFixedZeroTerminatedBuffer(
|
||||
swkbd_text_check.text_check_message.data(),
|
||||
swkbd_text_check.text_check_message.size());
|
||||
} else {
|
||||
return u"";
|
||||
}
|
||||
}();
|
||||
|
||||
LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}",
|
||||
GetTextCheckResultName(swkbd_text_check.text_check_result),
|
||||
|
Loading…
Reference in New Issue
Block a user