Skip to content

Updates for issue #150 to use UTF8 instead of String when dealing with data from the git repository - #229

Merged
Calinou merged 3 commits into
godotengine:masterfrom
markeel:utf8-issue
Apr 8, 2024
Merged

Calinou merged 3 commits into
godotengine:masterfrom
markeel:utf8-issue

Conversation

@markeel

@markeel markeel commented Apr 1, 2024 •

Copy link
Copy Markdown
Contributor

Re-implemented the original update for UTF-8 based on latest master, for a clean merge.

Replaced the places where the libgit2 API used godot::String with godot::String::utf8

Tested using emojis as place holders for language specific Unicode characters

  • in file names and directory names.
  • renames of files
  • commit messages

…ealing

with data from the git repository

@Calinou Calinou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (I haven't tested it though).

@markeel

markeel commented Apr 1, 2024

Copy link
Copy Markdown
Contributor Author

Great, what does it take to release it into the asset library?

@bruvzg bruvzg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following places probably should have UTF-8 conversion as well:

Old path:

godot::String old_path = entry->head_to_index->old_file.path;

Both "name" here:

branch_names.push_front(name);
} else {
branch_names.push_back(godot::String(name));

"name" here:

godot::String author = godot::String() + sig->name + " <" + sig->email + ">";

@bruvzg bruvzg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And few more:

Return value:

Remotes:

remotes.push_back(remote_array.strings[i]);

Bunch of godot::String(...) uses in git_callbacks.cpp

Username:

godot::String proper_username = username_from_url ? username_from_url : creds->username;

@Calinou

Calinou commented Apr 3, 2024

Copy link
Copy Markdown
Member

@markeel Can you make the requested changes? I'll merge this afterwards.

@markeel

markeel commented Apr 3, 2024 via email

Copy link
Copy Markdown
Contributor Author

@markeel

markeel commented Apr 4, 2024 •

Copy link
Copy Markdown
Contributor Author

I incorporated the items @bruvzg identified in his review. Those were subtle impacts. The only change I didn't apply was the one in git_callbacks related to username. The trickiness with this fix, is whether the string was already a "godot" string. In the case of the username it was coming from credentials and therefore was a "godot" string. When it comes from the URL the string cannot be UTF-8 since those are invalid characters in a URL.

During testing (where I created repositories and branch names with emojis in the name) I ran into problems where the messages being logged to the "Output" window using the UtilityFunction::print(...) methods needed to be updated. Many of the calls were converting from a "godot" string back to a CString, but then the print function would convert it back to a "godot" string but not convert the C string as a UTF-8. Since the print() method takes godot string it was more accurate and effective to remove this extraneous conversion to CString.

I also tested error legs, by shutting down the server running my remote repositories to see how pull and push reported errors.

@Calinou Calinou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Calinou
Calinou merged commit d6582fa into godotengine:master Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot show Chinese correctly

3 participants