pynvim: UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 18260: illegal

neoclide/coc.nvim#1828 Before i through is Coc.nvim problem but now look like it’s vim-snippets

Describe the bug

OS : window10 Neovim: 0.4.3 i check again the CocInfo it’t return different message

CocInfo


Output channel: Python

Starting Jedi Python language engine.

Output channel: snippets

[Info 17:39:57] Using ultisnips directories: UltiSnips E:\spacemacs\emacs26-3\AppData\Local\coc\ultisnips [Info 17:39:58] Using ultisnips python command: pyx Error on execute python script: request error nvim_command - Vim(return):Error invoking ‘python_execute_file’ on channel 4 (python3-script-host): error caught in request handler ‘python_execute_file [‘C:\Users\ADMINI~1\AppData\Local\Temp\coc.nvim-6652\coc-ultisnips-KLQQlwM_rh.py’, 1, 1]’: Traceback (most recent call last): File “E:\python\python3.8.1\lib\site-packages\pynvim\plugin\script_host.py”, line 106, in python_execute_file script = compile(f.read(), file_path, ‘exec’) UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa6 in position 18260: illegal multibyte sequence


init.vim


Plug 'neoclide/coc.nvim',{'branch':'release'}

inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"



" Snippet
" Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'

Try

I thought it’s cmd default encoding problem so change to utf-8 but don’t work

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 15 (11 by maintainers)

Most upvoted comments

maybe we can show a better error. But supporting non-utf8 file for python_execute_file does not seem like something we should do.

If so, open(encoding='utf-8') should be used instead. And to add the documentation.

Note: I don’t know what pyfile supports encodings in Vim8.