-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multibyte characters get corrupted when KEYBD trap is set #197
Labels
Comments
Steps to reproduce: $ uname -s -v |
@k-takahagi Do you have |
McDutchie
added a commit
to ksh93/ksh
that referenced
this issue
Dec 30, 2024
The KEYBD trap should now be fully functional for UTF-8 and other multibyte locales. Thanks to Johnothan King for finding this fix! Analysis: The KEYBD trap code processes character code points stored in e_lbuf by ed_read(). But shell variables store bytes, not characters. So, in UTF-8 locales for example, the Unicode code points need to be converted to multibyte UTF-8 encoding. This is needed to calculate the length of each encoded character in bytes (which fixes the corruption issue) and for keytrap() to store its UTF-8 representation in ${.sh.edchar}. src/cmd/ksh93/edit/edit.c: ed_getchar(): - Remove the workaround from the referenced commit. - Use mbconv to convert innput codepoints to bytes before adding them to inbuff, a char array that is passed on to keytrap(). Related: https://bugzilla.redhat.com/show_bug.cgi?id=1503922 Related: att#197 Related: #307 Resolves: #460 Co-authored-by: Johnothan King <[email protected]>
McDutchie
added a commit
to ksh93/ksh
that referenced
this issue
Dec 30, 2024
The KEYBD trap should now be fully functional for UTF-8 and other multibyte locales. Thanks to Johnothan King for finding this fix! Analysis: The KEYBD trap code processes character code points stored in e_lbuf by ed_read(). But shell variables store bytes, not characters. So, in UTF-8 locales for example, the Unicode code points need to be converted to multibyte UTF-8 encoding. This is needed to calculate the length of each encoded character in bytes (which fixes the corruption issue) and for keytrap() to store its UTF-8 representation in ${.sh.edchar}. src/cmd/ksh93/edit/edit.c: ed_getchar(): - Remove the workaround from the referenced commit. - Use mbconv to convert innput codepoints to bytes before adding them to inbuff, a char array that is passed on to keytrap(). Related: https://bugzilla.redhat.com/show_bug.cgi?id=1503922 Related: att#197 Related: #307 Resolves: #460 Co-authored-by: Johnothan King <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce:
KEYBD
trap in/etc/kshrc
(if it does not exist) :test
user and switch to it:あいうえお
from keyboardActual results:
BDFHJ
is displayed.Expected results:
あいうえお
should be displayed.There is some discussion around it in the abandoned patch #83
Related bug: https://bugzilla.redhat.com/show_bug.cgi?id=1503922
The text was updated successfully, but these errors were encountered: