Skip to content
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

It seems that this toolkit dosen't support GBK #149

Closed
Daylily-Zeleen opened this issue Dec 14, 2021 · 3 comments
Closed

It seems that this toolkit dosen't support GBK #149

Daylily-Zeleen opened this issue Dec 14, 2021 · 3 comments
Labels
bug Something isn't working formatter help wanted Extra attention is needed
Milestone

Comments

@Daylily-Zeleen
Copy link

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.

@Scony
Copy link
Owner

Scony commented Dec 14, 2021

@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 Scony added bug Something isn't working formatter labels Dec 14, 2021
@Daylily-Zeleen
Copy link
Author

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 '测试'.

@Scony Scony added the help wanted Extra attention is needed label Jan 7, 2022
@Scony Scony added this to the 3.x milestone Sep 17, 2022
@Scony Scony added this to Roadmap Feb 7, 2023
@Scony Scony removed this from the 3.x milestone Feb 7, 2023
@Scony Scony added this to the 4.x milestone Nov 5, 2023
@Scony
Copy link
Owner

Scony commented Mar 21, 2024

The above example works correctly on latest master

@Scony Scony closed this as completed Mar 21, 2024
@github-project-automation github-project-automation bot moved this to Done in Roadmap Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatter help wanted Extra attention is needed
Projects
Status: Done
Development

No branches or pull requests

2 participants