Skip to content
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

Character Set Not Supported #963

Closed
5 of 18 tasks
Chinggis6 opened this issue Jul 6, 2017 · 14 comments
Closed
5 of 18 tasks

Character Set Not Supported #963

Chinggis6 opened this issue Jul 6, 2017 · 14 comments
Labels

Comments

@Chinggis6
Copy link

  • Category
    • fzf binary
    • fzf-tmux script
    • Key bindings
    • Completion
    • Vim
    • Neovim
    • Etc.
  • OS
    • Linux
    • Mac OS X
    • Windows
    • Windows Subsystem for Linux
    • Etc.
  • Shell
    • bash
    • zsh
    • fish
    • cmd.exe
    • powershell.exe
  • Terminal
    • hyper

apart from the above

character set not supported

I installed fzf through chocolatey on Windows 10.
Issuing the following failed:

chcp 65001

as I found here.

@janlazo
Copy link
Contributor

janlazo commented Jul 8, 2017

Unset TERM before running fzf.

> echo %TERM%
xterm-256color
> fzf
character set not supported
> set "TERM="

> fzf

@janlazo
Copy link
Contributor

janlazo commented Jul 8, 2017

> echo %TERM_PROGRAM%
Hyper

cmd.exe, powershell.exe, sh.exe, and mintty.exe don't use it and none of them set it to Hyper so fzf can internally unset TERM like in cygwin.

@Chinggis6
Copy link
Author

Chinggis6 commented Jul 8, 2017

I could run it after unsetting %TERM% in cmd.exe.

Except in Git Bash where it hangs forever instead of outputting anything.

I wonder who set this environment variable to xterm. Hyper (and not Cygwin & GB) did I assume.

@janlazo
Copy link
Contributor

janlazo commented Jul 8, 2017

xterm-256color is hardcoded in app/session.js

const baseEnv = Object.assign({}, process.env, {
      LANG: app.getLocale().replace('-', '_') + '.UTF-8',
      TERM: 'xterm-256color',
      TERM_PROGRAM: productName,
      TERM_PROGRAM_VERSION: version
}, envFromConfig);

Hyper should not set TERM in Windows and let the shells handle this, such as sh.exe or bash.exe for TERM=cygwin.

@Chinggis6
Copy link
Author

Chinggis6 commented Jul 8, 2017

Uncommenting (prepend //) the 28th line in %localappdata%\hyper\app-1.3.3\resources\app\session.js file on Windows solved the issue. Thanks for the help.

@janlazo
Copy link
Contributor

janlazo commented Jul 8, 2017

@Chinggis6 You can unset TERM via the env object in .hyper.js so you don't have to uncomment in app/session.js on every installation.

module.exports = {
  config: {
    shell: '',  // defaults to cmd.exe if empty
    shellArgs: [],
    env: {
       // required in Windows so sh.exe and bash.exe can set it to cygwin
       // fzf supports only unset TERM and TERM=cygwin
       TERM: '',     
    },
  },
}

@ghost
Copy link

ghost commented Dec 6, 2017

This problem happens in all PowerShells from Windows 10 on since TERM is now always set by default. In order to not change fzf installation, I worked around this problem by creating a function alias for fzf in my PowerShell profile to save and restore TERM.

# Alias fzf to workaround https://github.com/junegunn/fzf/issues/963
function fzf() {
  try {
    $fzf = Get-Command -CommandType Application fzf -ErrorAction Stop
    if (Test-Path Env:\TERM) {
      $saveTERM = $Env:TERM
      $Env:TERM = ""
    }
    & $fzf @Args
  }
  finally {
    if (Test-Path Variable:\saveTERM) {
      $Env:TERM = $saveTERM
    }
  }
}

@janlazo
Copy link
Contributor

janlazo commented Dec 18, 2017

@tapuzzo-fsi What's the value of TERM in ConHost on Windows 10? Any documentation to refer to? Also, can you check on cmd.exe? TERM was set on Control Panel so it's set for cmd.exe as well on #1093 (comment)

@ghost
Copy link

ghost commented Dec 20, 2017

I do have the environment variable set in my Windows environment. But I came by it honestly based on reading about the new Windows ConEmu support for 24 bit color.

I can't track down exactly where it came from but I seems to have sprung from the new 24 bit RGB console support in Windows 10 Redstone 3.

(I'm beginning to think I'm insane but I could swear that I read somewhere that PowerShell is going to start defaulting $env:TERM to xterm-256color at some point -- but that is not the case with any of my Windows machines I have at easy reach including some on Windows Insider build 17025. Windows Subsystem for Linux's bash is defaulting to xterm on current Windows Redstone 3 (1709) as well as latest insider preview.)

@janlazo
Copy link
Contributor

janlazo commented Dec 21, 2017

This is an issue with openssh behavior with TERM and WSL bash. There is no mention of ConHost there From microsoft/WSL#345 (comment), microsoft/WSL#345 (comment), there is no "true" 24-bit color support for ConHost. WSL bash is a separate matter and should be handled as such because TERM is insufficient to distinguish WSL terminal and mintty.

Can you specify which terminal you are using to run powershell without a parent shell (cmd.exe, bash)?

As for ConEmu, it has supported 24-bit (via hooking) before Windows 10 and I rely on it on Windows 8.1 for 24-bit colorschemes on terminal Vim.

@janlazo
Copy link
Contributor

janlazo commented Dec 21, 2017

For regular Win 10 builds without WSL, TERM is unset in cmd.exe and powerhell on conhost so there's nothing fzf (Windows) can do about this.

@ulyssesdotcodes
Copy link

If you came here because of fzf.vim (over ssh), add this to the top of your fzf#run function in fzf/plugin/fzf.vim:

if $Term != ""
  let $saveTerm = $Term
  let $Term = ""
endif

And this at the bottom:

if $saveTerm != ""
  let $Term = $saveTerm
endif

@janlazo
Copy link
Contributor

janlazo commented Aug 27, 2019

Can anyone a provide a list of dependencies and steps (and example if possible) to replicate this problem?

If it's just (neo)vim + powershell + ssh, where does each program run and what's the combination? Is it powershell as the initial shell to run ssh and then run (neo)vim on a Unix-like OS for :FZF? Is powershell the login shell on the remote OS? If the request is to always ignore TERM on Windows, it can be done if tcell can't use the terminfo for Windows terminals, at least for ConEmu. Neovim 0.4 terminal uses it so termguicolors works now out-of-the-box.

@ulyssesdotcodes
Copy link

ulyssesdotcodes commented Aug 27, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants