question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unicode handling in xterm.js

See original GitHub issue

Coming from #1707 it seems the correct unicode handling is more and more an issue for people due to emojis. Since we all love emojis this should get fixed ASAP 😄

Proposal: Create a provider for different unicode versions, that is capable of hiding the version specific data and implementations behind a nice API. Currently we only need version dependent implementations for wcwidth, so a rough sketchup could look like this:

interface IUnicodeProvider {
  supportedVersions(): string[];
  getVersion(): string;
  setVersion(version?: string);  // version optional for fallback behavior
  wcwidth(ucs: number): number;
  getStringCellWidth(s: string): number;
  ... // more to come with support of other unicode features
}

Ideally the provider is self containing, thus the terminal just needs to deal with the interface methods and updates the version/locale when needed. The provider would have to deal with the low level stuff to provide the correct data sets so the methods just work as expected for a supported version. Within the provider we then can decide whether the data is provided statically in the code base or even tries to create the data on the fly. First will have quite an impact on xterm.js’ size, the second will raise async questions (remember - most of the core parts are synchronous atm). The whole unicode stuff could also be bundled into some addon like feature for version XY.

Up for discussion. /cc @Tyriar, @bgw, @mofux, @dnfield

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:11
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
jerchcommented, Dec 6, 2019

New attempt in https://github.com/xtermjs/xterm.js/pull/2568, hopefully we can get this rolled out with next release.

3reactions
mikegwhitcommented, Oct 2, 2019

Please fix ASAP, updating Windows recently seemed to break this for me. I’m attempting to support a Node.js library that emoji’fies some aspects of logging for easier readability (it sounds much goofier than it is).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Encoding - Xterm.js
Most terminal emulators as of today operate only with Unicode (UTF-8) directly, older ones would have direct support for various encodings. Still most...
Read more >
xterm-addon-unicode11 - npm
An addon providing Unicode version 11 rules for xterm.js.. Latest version: 0.5.0, last published: 4 days ago.
Read more >
XTerm js not handling special characters like \n "\u001b[H ...
I am using Xterm Js to create a console in my web browser, so far I have successfully implemented the functionality on server...
Read more >
xterm not displaying unicode - Unix & Linux Stack Exchange
Terminus is able to display your example. I'm using -fa "DejaVu Sans Mono:size=11:antialias=true" However, I don't understand your -js and - ...
Read more >
XTerm – Handling Ill-formed UTF-8 - Thomas E. Dickey
Actually, the proper Unicode replacement character is U+FFFD, but that was a start. Shortly after, Kuhn provided a patch to use U+FFFD (in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found