diff --git a/src/platforms/rcore_web_emscripten.c b/src/platforms/rcore_web_emscripten.c index 48492cfd4420..423d4fb45b96 100644 --- a/src/platforms/rcore_web_emscripten.c +++ b/src/platforms/rcore_web_emscripten.c @@ -1568,8 +1568,11 @@ static EM_BOOL EmscriptenKeyboardCallback(int eventType, const EmscriptenKeyboar } break; case EMSCRIPTEN_EVENT_KEYPRESS: { + unsigned int codepoint = keyboardEvent->charCode; + if ((codepoint < 32) || ((codepoint > 126) && (codepoint < 160))) break; + // Check if there is space available in the queue for characters to be added - if ((keyboardEvent->charCode > 0) && (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)) + if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE) { CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = keyboardEvent->charCode; CORE.Input.Keyboard.charPressedQueueCount++;