diff --git a/imgui.cpp b/imgui.cpp index 915c581a..6083fa4d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -778,6 +778,18 @@ void ImGuiIO::AddInputCharacter(ImWchar c) } } +void ImGuiIO::AddInputCharactersUTF8(const char* utf8chars) +{ + // we can't pass more wchars than ImGuiIO::InputCharacters[] can hold so don't convert more + static const int wcharBufLen = sizeof(ImGuiIO::InputCharacters)/sizeof(ImWchar); + ImWchar wchars[wcharBufLen]; + ImTextStrFromUtf8(wchars, wcharBufLen, utf8chars, NULL); + for(int i=0; i