diff --git a/docs/faq.markdown b/docs/faq.markdown index c26c74081..8459557ba 100644 --- a/docs/faq.markdown +++ b/docs/faq.markdown @@ -13,7 +13,8 @@ Note that if you change your environment you will likely need to kill and restart your tmux server before it will take effect. You probably should also review [this relevant section from the -TMUX FAQ](https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-utf-8) +TMUX FAQ](https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-utf-8), and +read on for more information about LANG and locale below. ## Some glyphs look messed up, why is that? @@ -102,4 +103,56 @@ If you're seeing this sort of issue, then you may be able to upgrade the affected application on that system to see if a newer version resolves that issue. +## How to troubleshoot keys that don't work or produce weird characters!? + +There are a number of layers in input processing that can influence this. + +The first thing to note is that `wezterm` will always and only output `UTF-8` +encoded text. Your `LANG` and locale related environment must be set to +reflect this; there is more information on that above. + +If the key in question is produced in combination with Alt/Option then [this +section of the docs describes how wezterm processes +Alt/Option](config/keys.html), as well as options that influence that behavior. + +The next thing to verify is what byte sequences are being produced when you +press keys. I generally suggest running `xxd`, pressing the relevant key, then +enter, then CTRL-D. This should show a hex dump of the the byte sequence. +This step helps to isolate the input from input processing layers in other +applications. + +Interactive Unix programs generally depend upon the `TERM` environment variable +being set appropriately. `wezterm` sets this to `xterm-256color` by default, +because wezterm aims to be compatible with with the settings defined by that +terminfo entry. Setting TERM to something else can change the byte sequences +that interactive applications expect to see for some keys, effectively +disabling those keys. + +On top of this, a number of programs use libraries such as GNU readline +to perform input processing. That means that settings in your `~/.inputrc` +may changing the behavior of `bash`. Verify any settings in there that +might influence how input is resolved and see the question below +about `convert-meta`! + +If you are using `tmux` be aware that it introduces its own set of input/output +processing layers that are also sensitive to `LANG`, `TERM` and locale and how +they are set in the environment of the tmux server when it was spawned, the +tmux client and inside the processes spawned by tmux. It is generally best to +troubleshoot input/output weirdness independent of tmux first to minimize the +number of variables! + +If after experimenting with your environment and related settings you believe +that wezterm isn't sending the correct input then please [open an +issue](https://github.com/wez/wezterm/issues) and include the `xxd` hexdump, +and output from `env` and any other pertinent information about what you're +trying and why it doesn't match your expectations. + +## I have `set convert-meta on` in my `~/.inputrc` and latin characters are broken!? + +That setting causes Readline to re-encode latin-1 and other characters +as a different sequence (eg: `£` will have the high bit stripped and turn +it into `#`). + +You should consider disabling that setting when working with a UTF-8 +environment.