luk400 / vim-jukit

Jupyter-Notebook inspired Neovim/Vim Plugin
MIT License
603 stars 23 forks source link

GBK code doesn't work #58

Closed cyoki closed 1 year ago

cyoki commented 1 year ago

Hi, the plugin is perfect, but would you mind adding encoding='ISO-8859-1' to read and write a file? because some files need other encoding to read and write, my file have some GBK characters, it didn't work at first, then I changed the encoding and it works.

luk400 commented 1 year ago

Hi, could you specify in more detail what exactly doesn't work? Because I seem to be able to convert from .ipynb files to .py files and execute code in them with no issues even when they contain GBK characters.

cyoki commented 1 year ago

I'm sorry, but I accidentally deleted that file. However, I think the issue was due to a file encoding problem. After forking your repository and changing all the read file encoding to ISO-8859-1, I was able to access all the files successfully. I believe the problem occurred because my file had some strange symbols that couldn't be read by the default encoding.

luk400 commented 1 year ago

So I've now added the option g:jukit_file_encodings to address this issue, which is by default set to 'utf-8'. Just specify let g:jukit_file_encodings="ISO-8859-1" in your config (before the plugin is loaded) and this should hopefully solve it. Feel free to reopen the issue if for some reason the problem still persists