diff --git a/source/gui/detail/bedrock_posix.cpp b/source/gui/detail/bedrock_posix.cpp index 8412cb04..dcbea76d 100644 --- a/source/gui/detail/bedrock_posix.cpp +++ b/source/gui/detail/bedrock_posix.cpp @@ -983,8 +983,8 @@ namespace detail nana::detail::charset_conv charset(NANA_UNICODE, "UTF-8"); const std::string& str = charset.charset(std::string(keybuf, keybuf + len)); - charbuf = reinterpret_cast(str.c_str()) + 1; - len = str.size() / sizeof(wchar_t) - 1; + charbuf = reinterpret_cast(str.c_str()); + len = str.size() / sizeof(wchar_t); for(int i = 0; i < len; ++i) { @@ -992,6 +992,9 @@ namespace detail arg.ignore = false; arg.key = charbuf[i]; + // ignore Unicode BOM (it may or may not appear) + if (arg.key == 0xFEFF) continue; + //Only accept tab when it is not ignored. if ((keyboard::tab == arg.key) && root_runtime->condition.ignore_tab) continue;