stdlib: Clean up and export SDL_UCS4ToUTF8().

Also fix internal usage of the function.

Fixes #10157.
This commit is contained in:
Ryan C. Gordon
2024-07-04 01:09:46 -04:00
parent f338fa20dd
commit c3bf874abf
9 changed files with 74 additions and 33 deletions

View File

@@ -543,9 +543,9 @@ static EM_BOOL Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboard
if (SDL_TextInputActive(window_data->window)) {
char text[5];
if (SDL_UCS4ToUTF8(keyEvent->charCode, text)) {
SDL_SendKeyboardText(text);
}
char *end = SDL_UCS4ToUTF8(keyEvent->charCode, text);
*end = '\0';
SDL_SendKeyboardText(text);
return EM_TRUE;
}
return EM_FALSE;