pappasam / nginx-language-server

Language server for nginx.conf
GNU General Public License v3.0
66 stars 2 forks source link

Cannot start nginx-language-server on Windows (UnicodeDecodeError) #7

Closed yaegassy closed 3 years ago

yaegassy commented 3 years ago

I use macOS as my main OS.

When I tried nginx-language-server on "Windows", I got an error and could not start it.

UnicodeDecodeError:

(venv) C:\Users\yaegassy\nginx-ls-check>nginx-language-server
Traceback (most recent call last):
  File "C:\Users\yaegassy\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\yaegassy\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\yaegassy\nginx-ls-check\venv\Scripts\nginx-language-server.exe\__main__.py", line 4, in <module>
  File "c:\users\yaegassy\nginx-ls-check\venv\lib\site-packages\nginx_language_server\cli.py", line 5, in <module>
    from .server import SERVER
  File "c:\users\yaegassy\nginx-ls-check\venv\lib\site-packages\nginx_language_server\server.py", line 26, in <module>
    from .parser import DIRECTIVES, VARIABLES, nginxconf
  File "c:\users\yaegassy\nginx-ls-check\venv\lib\site-packages\nginx_language_server\parser\__init__.py", line 4, in <module>
    from .data import (
  File "c:\users\yaegassy\nginx-ls-check\venv\lib\site-packages\nginx_language_server\parser\data.py", line 160, in <module>
    DIRECTIVES = get_directives(load_raw_data("directives.json"))
  File "c:\users\yaegassy\nginx-ls-check\venv\lib\site-packages\nginx_language_server\parser\data.py", line 132, in load_raw_data
    data_raw = json.load(outfile)
  File "C:\Users\yaegassy\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
UnicodeDecodeError: 'cp932' codec can't decode byte 0x9d in position 2046: illegal multibyte sequence
pappasam commented 3 years ago

@yaegassy I believe this should be fixed in the latest release. Please test it out on Windows and let me know if I'm wrong!

yaegassy commented 3 years ago

@pappasam I immediately tried it out. I have confirmed that I can boot normally in Windows.