godot-gdscript-toolkit icon indicating copy to clipboard operation
godot-gdscript-toolkit copied to clipboard

It seems that this toolkit dosen't support GBK

Open Daylily-Zeleen opened this issue 2 years ago • 2 comments

I start to convert my 3.x project to 4.0, and run 'gdformat' command to format my script. But I got an error like this:

C:\Users\73517>gdformat C:\Users\73517\OneDrive\Godot\Project\equipment-manage-system\addons\table\Table.gd Traceback (most recent call last): File "C:\Users\73517\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return run_code(code, main_globals, None, File "C:\Users\73517\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code exec(code, run_globals) File "C:\Users\73517\AppData\Local\Programs\Python\Python310\Scripts\gdformat.exe_main.py", line 7, in File "C:\Users\73517\AppData\Local\Programs\Python\Python310\lib\site-packages\gdtoolkit\formatter_main.py", line 71, in main format_files(files, line_length, safety_checks) File "C:\Users\73517\AppData\Local\Programs\Python\Python310\lib\site-packages\gdtoolkit\formatter_main.py", line 145, in _format_files code = fh.read() UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 335: illegal multibyte sequence

I wrote many script comments in Chinese, I'm sure that this is the reason of the error. Because of lacking of knowledge of character coding and python, I don't know how to solve it.

Daylily-Zeleen avatar Dec 14 '21 15:12 Daylily-Zeleen

@Daylily-Zeleen Can you share 1 example file which fails like above? Btw. Please note that GDScript 2.0 is not yet fully supported.

Scony avatar Dec 14 '21 16:12 Scony

I‘m not familiar with the workflow of convert to 4.0, I just try to obey the description of qarmin's pr.

Here is my minimized example script code:

""" 测试脚本: """ extends Node

var a = 1

After I do some test, the reason of this error is Chinese punctuation mark , such as ':', ',' and so on, instead of the Chinese words like '测试'.

Daylily-Zeleen avatar Dec 14 '21 16:12 Daylily-Zeleen