From: Alan Third <alan@idiocy.org>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 29837@debbugs.gnu.org
Subject: bug#29837: UTF-16 char display problems and the macOS "character palette"
Date: Tue, 26 Dec 2017 01:34:23 +0000 [thread overview]
Message-ID: <20171226013423.GB79310@breton.holly.idiocy.org> (raw)
In-Reply-To: <CAArVCkRx8p_vaFKJ_kXRuoZCKVBSYr=94RJANGpU0NXvkEZv6A@mail.gmail.com>
On Mon, Dec 25, 2017 at 08:13:55PM +0000, Philipp Stephani wrote:
> IIUC Emacs receives the input as a single UTF-16 string (in
> insertText), then iterates over the UTF-16 code units, converting
> each into an Emacs event. That's wrong, no matter whether the input
> comes from the character palette or from the keyboard; normal
> keyboard layouts just happen to not contain non-BMP characters. The
> loop needs to account for surrogates.
I finally came to this conclusion myself. I now know a lot more about
UTF‐16 than I did yesterday. :)
Wish I’d looked at my email earlier, though.
> As a small optimization (which is warranted because the function is
> probably called on every keystroke), this should use [NSString
> getCharacters:range:] to copy all the UTF-16 code units to a buffer
> first, to avoid repeated calls to characterAtIndex.
Presumably the vast majority of input will consist of just one code
unit, though?
--
Alan Third
prev parent reply other threads:[~2017-12-26 1:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-24 16:00 bug#29837: UTF-16 char display problems and the macOS "character palette" Alan Third
2017-12-24 16:56 ` Eli Zaretskii
2017-12-24 18:23 ` Alan Third
2017-12-24 18:57 ` Eli Zaretskii
2017-12-24 19:28 ` Alan Third
2017-12-24 19:34 ` Eli Zaretskii
2017-12-25 20:13 ` Philipp Stephani
2017-12-25 21:07 ` Philipp Stephani
2017-12-26 1:34 ` Alan Third [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171226013423.GB79310@breton.holly.idiocy.org \
--to=alan@idiocy.org \
--cc=29837@debbugs.gnu.org \
--cc=p.stephani2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).