| 
13 | 13 | #include <algorithm>  | 
14 | 14 | #include <cassert>  | 
15 | 15 | #include <cmath>  | 
 | 16 | +#include <codecvt>  | 
 | 17 | +#include <locale>  | 
16 | 18 | #include <unordered_map>  | 
17 | 19 | 
 
  | 
18 | 20 | #include "flutter/shell/platform/linux_embedded/logger.h"  | 
@@ -748,7 +750,10 @@ const zwp_text_input_v1_listener ELinuxWindowWayland::kZwpTextInputV1Listener =  | 
748 | 750 | 
 
  | 
749 | 751 |           auto self = reinterpret_cast<ELinuxWindowWayland*>(data);  | 
750 | 752 |           if (self->binding_handler_delegate_ && strlen(text)) {  | 
751 |  | -            self->binding_handler_delegate_->OnVirtualKey(text[0]);  | 
 | 753 | +            std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>  | 
 | 754 | +                utf8_converter;  | 
 | 755 | +            std::u16string utf16_text = utf8_converter.from_bytes(text);  | 
 | 756 | +            self->binding_handler_delegate_->OnVirtualKey(utf16_text[0]);  | 
752 | 757 |           }  | 
753 | 758 |           if (self->zwp_text_input_v1_) {  | 
754 | 759 |             zwp_text_input_v1_reset(self->zwp_text_input_v1_);  | 
@@ -779,7 +784,10 @@ const zwp_text_input_v1_listener ELinuxWindowWayland::kZwpTextInputV1Listener =  | 
779 | 784 |           // commit_string is notified only when the space key is pressed.  | 
780 | 785 |           auto self = reinterpret_cast<ELinuxWindowWayland*>(data);  | 
781 | 786 |           if (self->binding_handler_delegate_ && strlen(text)) {  | 
782 |  | -            self->binding_handler_delegate_->OnVirtualKey(text[0]);  | 
 | 787 | +            std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>  | 
 | 788 | +                utf8_converter;  | 
 | 789 | +            std::u16string utf16_text = utf8_converter.from_bytes(text);  | 
 | 790 | +            self->binding_handler_delegate_->OnVirtualKey(utf16_text[0]);  | 
783 | 791 |           }  | 
784 | 792 |           // If there is no input data, the backspace key cannot be used,  | 
785 | 793 |           // so set dummy data.  | 
@@ -895,7 +903,10 @@ const zwp_text_input_v3_listener ELinuxWindowWayland::kZwpTextInputV3Listener =  | 
895 | 903 | 
 
  | 
896 | 904 |           auto self = reinterpret_cast<ELinuxWindowWayland*>(data);  | 
897 | 905 |           if (self->binding_handler_delegate_ && strlen(text)) {  | 
898 |  | -            self->binding_handler_delegate_->OnVirtualKey(text[0]);  | 
 | 906 | +            std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>  | 
 | 907 | +                utf8_converter;  | 
 | 908 | +            std::u16string utf16_text = utf8_converter.from_bytes(text);  | 
 | 909 | +            self->binding_handler_delegate_->OnVirtualKey(utf16_text[0]);  | 
899 | 910 |           }  | 
900 | 911 |         },  | 
901 | 912 |         .delete_surrounding_text = [](void* data,  | 
 | 
0 commit comments