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
Fail to parse source files that are encoded in zh_CN.GBK #1458
Comments
Can you post a simple test case? |
an sample code will do. int main() When you copy the sample code to your workspace, make sure that the Chinese comments at the first line are encoded in GBK. iconv -f utf-8 -t gbk may help. Thanks for helping. |
I think that this is a duplicate of ycm-core/ycmd#109 |
If you think It's not a duplicate, let me know. |
I am not so familiar to git. I guess that my problem is a duplicate. It seems that this bug has been fixed. So I only need to update to the newest version? |
@caterchong It is not fixed yet, but to me it seems that it has been already reported to the |
The completion works fine if the source code is encoding in utf-8 format. When I revert the source files to GBK encoding, it never works right. |
It is known at the moment that YCM do not work at its best with unicode. I don't know what is the expected behaviour in this case, so I'll reopen this and let @Valloric tell you what it should be. |
Your encoding in Vim should be utf8; other encodings are not supported. They might or might not work. |
The time I run the command":YcmDiags", errors below will show up. Can I change the default decoder? Thanks very much.
UnicodeDecodeError: 'utf8' codec can't decode byte 0xcd in position 0: invalid continuation byte
Traceback (most recent call last):
File "/home/cater/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
return route.call(*_args)
File "/home/cater/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
rv = callback(_a, *_ka)
File "/home/cater/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 100, in wrapper
return callback( *args, *_kwargs )
File "/home/cater/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 54, in wrapper
body = callback( _args, *_kwargs )
File "/home/cater/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 58, in EventNotification
request_data = RequestWrap( request.json )
File "/home/cater/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 182, in get
if key not in storage: storage[key] = self.getter(obj)
File "/home/cater/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1125, in json
return json_loads(self._get_body_string())
File "/usr/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
obj, end = self.scan_once(s, idx)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xcd in position 0: invalid continuation byte
The text was updated successfully, but these errors were encountered: