Skip to content

Handle ASCII in send_unicode_string with keycodes#26272

Open
nkgotcode wants to merge 1 commit into
qmk:developfrom
nkgotcode:fix/send-unicode-string-ascii
Open

Handle ASCII in send_unicode_string with keycodes#26272
nkgotcode wants to merge 1 commit into
qmk:developfrom
nkgotcode:fix/send-unicode-string-ascii

Conversation

@nkgotcode

Copy link
Copy Markdown

Description

Updates send_unicode_string() to emit ASCII characters through QMK's existing send-string keycode path when the decoded character has a keycode mapping. Non-ASCII characters continue to use the configured Unicode input mode.

Fixes #25382

Types of Changes

  • Core
  • Bugfix
  • N/A: New feature
  • Enhancement/optimization
  • N/A: Keyboard (addition or update)
  • N/A: Keymap/layout (addition or update)
  • N/A: Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • N/A: My change requires a change to the documentation.
  • N/A: I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@github-actions github-actions Bot added the core label Jun 18, 2026
Comment thread quantum/unicode/unicode.c
str = decode_utf8(str, &code_point);

if (code_point >= 0) {
if (code_point > 0 && code_point < 0x80 && pgm_read_byte(&ascii_to_keycode_lut[code_point]) != XXXXXXX) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the actual keycode.

Suggested change
if (code_point > 0 && code_point < 0x80 && pgm_read_byte(&ascii_to_keycode_lut[code_point]) != XXXXXXX) {
if (code_point > 0 && code_point < 0x80 && pgm_read_byte(&ascii_to_keycode_lut[code_point]) != KC_NO) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is also better encapsulated if its implemented within quantum/send_string/send_string.{h,c} as something like is_valid_send_char().

@tzarc tzarc changed the base branch from master to develop June 18, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] send_unicode_string() is inefficient for ASCII characters

4 participants