Skip to content

Feature/unicode dash support#252

Merged
m-messer merged 2 commits intomainfrom
feature/unicode-dash-support
May 1, 2026
Merged

Feature/unicode dash support#252
m-messer merged 2 commits intomainfrom
feature/unicode-dash-support

Conversation

@m-messer
Copy link
Copy Markdown
Member

Problem:
Students using international keyboards may produce Unicode dash characters — such as the en dash (–), em dash (—), or Unicode minus sign (−) — instead of the ASCII hyphen-minus (-) when entering a minus sign. These characters
are visually identical to - but are not recognised by the SymPy parser, causing valid expressions to fail silently.

Fix:
Added convert_unicode_dashes(expr) to expression_utilities.py. The function follows the same substitution-pair pattern as the existing transform_unicode_greek_symbols: it inspects the expression string for any of the eight.
Unicode dash variants and returns (unicode_char, "-") pairs to be applied during preprocessing, before the expression reaches the parser.

All other changes are tests. A new file app/tests/expression_utilities_test.py adds direct unit tests for every public function in expression_utilities, including the new function (13 cases covering each dash variant,
multi-dash expressions, and the no-dash case).

Copy link
Copy Markdown
Member

@peterbjohnson peterbjohnson left a comment

Choose a reason for hiding this comment

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

Love this!

@m-messer m-messer merged commit a02db6a into main May 1, 2026
1 check 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