Correct backspace for multibyte characters#1451
Merged
Merged
Conversation
squell
commented
Feb 11, 2026
squell
commented
Feb 11, 2026
squell
commented
Feb 11, 2026
bjorn3
reviewed
Feb 11, 2026
This comment was marked as outdated.
This comment was marked as outdated.
33d2e7b to
dfdb7c7
Compare
dfdb7c7 to
2d63112
Compare
Member
Author
|
This can be reviewed commit by commit; the first has the most churn but should be a neutral change; the second is neutral as well (but the final change necessary in |
2d63112 to
7c145ea
Compare
7c145ea to
5949b9f
Compare
bjorn3
reviewed
Feb 12, 2026
bjorn3
reviewed
Feb 12, 2026
bjorn3
reviewed
Feb 12, 2026
bjorn3
reviewed
Feb 12, 2026
bjorn3
approved these changes
Feb 12, 2026
Member
Author
|
I've also compared |
Member
Author
|
This of course made me curious, e.g. for EUC-JP: even if it is being used, would it be used for writing passwords? This Reddit thread seems to suggest not. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since we use a very low-level password entry we need to take care of backspaces, kill characters, etc; but also this. This function conservatively only deals with UTF8 (and non-UTF8 sequences will simply continue to be seen as individual bytes).
This same behaviour is in ogsudo; if we agree on this fix I'll attempt to contribute it back there as well.
Note that the fix does not use the current locale, since the encoding that a password arrives in is determined by the terminal the user has than the local LC_CTYPE setting. And normally a mismatch between that is noticeable, but not so much in the password prompt since that is silent.
So the solution is that the multibyte detection is heuristic in the sense that:
påsswørdif it is in ISO8859-1), except if it contains mojibake such aspȧsswørd(but then the most likely intent of the user was to indeedpȧsswørd)