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

Cannot show Chinese correctly #150

Closed
Tracked by #228
jinyangcruise opened this issue Jan 8, 2023 · 5 comments · Fixed by #229
Closed
Tracked by #228

Cannot show Chinese correctly #150

jinyangcruise opened this issue Jan 8, 2023 · 5 comments · Fixed by #229

Comments

@jinyangcruise
Copy link

jinyangcruise commented Jan 8, 2023

image

image

@Calinou Calinou added the bug label Jan 8, 2023
@dreamtwi
Copy link

dreamtwi commented Mar 4, 2023

Same Issue here, using windows 11

@markeel
Copy link
Contributor

markeel commented May 25, 2023

This appears to be a problem with the encoding assumptions made when reading from the libgit2 library. That library is simply an array of characters. It could be encoded as anything, but probably is encoded as UTF-8. What it is NOT encoded as a 32 bit unicode encoding, which is what godot::String holds internally. The constructor used assumes that it is the char array is 8 bits which is then converted to a 32 bit internal storage (see String::copy_from() in core/string/ustring.cpp).

A reasonable fix is to assume all data from libgit2 is UTF8. This should handle almost everyone, For those that have to have their data stored in another encoding, there would need to be an "encoding" parameter probably at the VCS data level (at the same place the user/password/ssh key are recorded.

I believe that an enhancement should be created for including an "encoding" parameter, and that the current plugin should be updated to assume UTF-8.

I'll create a pull request with the defaulting to UTF-8, but please discuss if this doesn't seem like a good solution.

@jinyangcruise
Copy link
Author

I think default to UTF-8 willl be good. On the other hand, For those that have to have their data stored in another encoding, there would need to be an "encoding" parameter probably at the VCS data level, what if I have different encoding files, one encoding parameter is not enough for this situation. This remainds me of some software I used before like Ultra Edit, IntelliJ IDEA and so on, they can show charactors well. I guess they can detect file's encoding or do something to transfer different encoding data to one common encoding maybe? But detecting encoding may be complicated.

@Calinou
Copy link
Member

Calinou commented Mar 28, 2024

See #218 (comment) for a possible solution.

@markeel
Copy link
Contributor

markeel commented Apr 1, 2024

I closed the out of date pull request and created a new one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants