applets/swkbd: Fix text check message encoding

The text check message can be encoded in UTF-8.
This commit is contained in:
Morph 2021-11-08 14:57:53 -05:00
parent 1af499c15b
commit 3af2117c88

View file

@ -278,13 +278,21 @@ void SoftwareKeyboard::ProcessTextCheck() {
std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck)); std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck));
std::u16string text_check_message = std::u16string text_check_message = [this, &swkbd_text_check]() -> std::u16string {
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure || if (swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure ||
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm) {
? Common::UTF16StringFromFixedZeroTerminatedBuffer( return swkbd_config_common.use_utf8
swkbd_text_check.text_check_message.data(), ? Common::UTF8ToUTF16(Common::StringFromFixedZeroTerminatedBuffer(
swkbd_text_check.text_check_message.size()) reinterpret_cast<const char*>(
: u""; 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: {}", LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}",
GetTextCheckResultName(swkbd_text_check.text_check_result), GetTextCheckResultName(swkbd_text_check.text_check_result),