New issue
Advanced search Search tips

Issue 763850 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

hterm: hterm.Keyboard.prototype.onTextInput_ doesn't handle UTF-8 properly

Project Member Reported by vapier@chromium.org, Sep 11 2017

Issue description

we have this bit of code:
hterm.Keyboard.prototype.onTextInput_ = function(e) {
  if (!e.data)
    return;

  e.data.split('').forEach(this.terminal.onVTKeystroke.bind(this.terminal));
};

the String.split() does not support surrogate pairs which causes us to send them down one codeunit at a time which messes up codepoints over U+FFFF.

need to determine whether we should send down codeunits (easiest) or graphemes (easier once we have grapheme splitting logic).  probably should use the former since this is onVTKeystroke.
 

Comment 1 by vapier@chromium.org, Sep 14 2017

Owner: vapier@chromium.org
Status: Fixed (was: Available)
this will be fixed in hterm-1.73+ and nassh-0.8.38+
Project Member

Comment 2 by bugdroid1@chromium.org, Sep 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/apps/libapps/+/e5a61b042646dfbbc22515790c4e2b5f69d17064

commit e5a61b042646dfbbc22515790c4e2b5f69d17064
Author: Mike Frysinger <vapier@chromium.org>
Date: Thu Sep 14 16:28:49 2017

hterm: stop mangling input from IMEs/etc...

The String.split method breaks surrogates up so we end up passing them
down one at a time (at which point things get corrupted).  This isn't
even really needed as the onVTKeystroke function already deals with
entire strings and processes them correctly.

We didn't notice in the past as this only affects codepoints over
U+FFFF which were uncommon.  People trying to use emoji (for some
reason) have noticed that they failed.

BUG= chromium:763850 

Change-Id: Ibb46c47ea06fe35f4e92eb4c0f78aa9bc1d0b047
Reviewed-on: https://chromium-review.googlesource.com/665840
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/e5a61b042646dfbbc22515790c4e2b5f69d17064/hterm/js/hterm_keyboard.js

Sign in to add a comment