Closed ShuguangSun closed 6 years ago
Thanks for your feedback.
Someone else already reported this bug, but it seems it didn't prevent completion from working. Do you just get the warning or is completion broken as well?
I'm working on a fix right now, I'll updated you when I release it.
Okay, I've released a fix on the unicode-fix
branch, this how you would install it with vim-plug
:
Plug 'gaalcaras/ncm-R', {'branch': 'unicode-fix'}
If you still get an error message and if completion doesn't work, please check the encodings of files in your g:rplugin_compldir
directory. My guess is at least one of them is not using correct UTF-8.
You are right. Some of the files in g:rplugin_compldir are not UTF-8.
All right. Can you please answer the following questions? That would be helpful to write a patch, I'd like to improve the way ncm-R loads completion data:
It is from Nvim-R: https://github.com/jalvesaq/Nvim-R/issues/276#issuecomment-361588169
Okay, thank you! I see the problem is already solved in Nvim-R, so I'm closing this issue.
Just for document. In window, the function open will decide the encoding according to the system local (in my case gbk). Even if the file is encoded using utf-8, python open will try to decode it with gbk. It is the error message comes.
In python 3, "encoding='utf-8' in open function can help. However it has side effect and requires all omnils encoded using 'utf-8'.
open(pkg_desc, encoding='utf-8', mode = 'r')
Exactly, that's what https://github.com/gaalcaras/ncm-R/commit/ff3297b8b134847db5107e48c4b75f56ee89ec1e did 😉
System: Windows in Chinese (gbk/cp936) Vim: Vim 8 Python: 3.6.3 (will it be supposed to utf8 as default?)
Nvim-R and ncm-R are used. When I type in the R script files, it raise the error message: Could not load completion data: 'gbk' codec can't decode byte 0x99 in positon.. It has been set:
set fileencodings=utf-8,cp936,big5,euc-jp,euc-kr,latin1,ucs-bom
In .Rprofile : options(encoding = "UTF-8") I don't know why the gbk codec comes.