Skip to content

fix(converter): Æ morse key has a stray leading space (KeyError)#2137

Merged
rlundeen2 merged 2 commits into
microsoft:mainfrom
WatchTree-19:fix-morse-ae-ligature-keyerror
Jul 8, 2026
Merged

fix(converter): Æ morse key has a stray leading space (KeyError)#2137
rlundeen2 merged 2 commits into
microsoft:mainfrom
WatchTree-19:fix-morse-ae-ligature-keyerror

Conversation

@WatchTree-19

Copy link
Copy Markdown
Contributor

problem

MorseConverter raises KeyError on any prompt containing æ/Æ:

MorseConverter().convert_async(prompt="æther")  # KeyError: 'Æ'

in the extended-character map the Æ entry is keyed " Æ" (stray leading space). supported_charset is built by joining the mapping keys, so the ' ' and 'Æ' characters both land in it and "Æ" in supported_charset is True - but the lookup dict only has the key " Æ", so morse_mapping["Æ"] raises KeyError. the converter hardcodes extended_char_support=True, so it advertises Æ as supported.

fix

key the entry "Æ" (its morse .-.- is unchanged and matches the neighbouring Ä/Ą).

test

added test_morse_converter_extended_ae_ligature / ..._in_word. both fail on main (KeyError), pass with the fix (æ -> .-.-); full test_morse_converter.py 8 pass, ruff clean.

found by reading the converter.

The extended morse map keyed Æ as " Æ" (leading space), so Æ was in
supported_charset but missing from the lookup, making MorseConverter raise
KeyError on any input containing æ/Æ. +regression tests.

Signed-off-by: WatchTree-19 <119982314+WatchTree-19@users.noreply.github.com>
@rlundeen2 rlundeen2 self-assigned this Jul 8, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rlundeen2 rlundeen2 added this pull request to the merge queue Jul 8, 2026
Merged via the queue into microsoft:main with commit 4aea051 Jul 8, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants