mechatroner / vscode_rainbow_csv

🌈Rainbow CSV - VS Code extension: Highlight CSV and TSV files in different rainbow colors to make them more readable
MIT License
426 stars 51 forks source link

Don't support Chinese GBK encoding #127

Open nopdan opened 1 year ago

nopdan commented 1 year ago

Don't support Chinese GBK encoding. It always seems to use utf-8 encoding.

mechatroner commented 1 year ago

Hello! Could you please clarify this? The extension itself is encoding-oblivious it deals with the JS strings decoded by the editor. So if VSCode supports GBK, then Rainbow CSV should "support" it too. Or are you talking about RBQL?

nopdan commented 1 year ago

Hello! Could you please clarify this? The extension itself is encoding-oblivious it deals with the JS strings decoded by the editor. So if VSCode supports GBK, then Rainbow CSV should "support" it too. Or are you talking about RBQL?

If rainbow csv does not take effect, it can be opened normally. After 1 second, it becomes garbled. 1

mechatroner commented 1 year ago

Thank you for the demo! Did you try to manually switch the encoding to "GBK" by clicking on the encoding button at the bottom? what happens in that case? Does this still happen with other extensions disabled? Could you also please attach a file here that could be used to reproduce the problem? Thanks!

nopdan commented 1 year ago

I've tried it and it's very effective. 092.txt

mechatroner commented 1 year ago

Thanks! I did some tests with your file and in my case VSCode always opens it with UTF-8 encoding no matter if Rainbow CSV is enabled or not. But if I manually switch the encoding to GBK it fixes the characters and it works with Rainbow CSV too. So I don't think that Rainbow CSV is causing this issue, moreover extensions do not have capability to initiate encoding switch: https://github.com/microsoft/vscode/issues/824.

nopdan commented 1 year ago

Thanks! I did some tests with your file and in my case VSCode always opens it with UTF-8 encoding no matter if Rainbow CSV is enabled or not. But if I manually switch the encoding to GBK it fixes the characters and it works with Rainbow CSV too. So I don't think that Rainbow CSV is causing this issue, moreover extensions do not have capability to initiate encoding switch: microsoft/vscode#824.

In my case, when I disable Rainbow CSV extension it becomes normal. Do you set the files.autoGuessEncoding to true?

nopdan commented 1 year ago

Thanks! I did some tests with your file and in my case VSCode always opens it with UTF-8 encoding no matter if Rainbow CSV is enabled or not. But if I manually switch the encoding to GBK it fixes the characters and it works with Rainbow CSV too. So I don't think that Rainbow CSV is causing this issue, moreover extensions do not have capability to initiate encoding switch: microsoft/vscode#824.

I turned off all the extensions except Rainbow CSV and the problem continued. The question seems to be rainbow_csv.enable_separator_autodetection. How does Rainbow CSV detect separator?

mechatroner commented 1 year ago

Sorry for the late reply, I was able to reproduce the problem with files.autoGuessEncoding. I will take a look at it later when I have more time, thanks again for the bug report!

mechatroner commented 1 year ago

Looks like this is actually related to an issue in the VSCode itself see https://github.com/microsoft/vscode/issues/39084 and https://github.com/microsoft/vscode/issues/127936. And actually, it is possible to reproduce the problem even with Rainbow CSV disabled - if you switch the file type of your file to e.g. 'C++' in the bottom right corner, not only file type would change but encoding too and garble the characters.