Correctly handle filename encoding #358
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
java
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
java-gi/java-gi!358
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "filenames"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GLib supports filesystems with encodings other than UTF8. These paths and filenames are annotated as "filename". Up until now, Java-GI treated them as ordinary UTF8 strings, which will not work on non-UTF8 encoded filesystems where the filename has special characters. This is now correctly implemented: Java-GI has a class
org.javagi.base.Filenamethat stores the filename as a rawbyte[], and can be converted to and from Strings using the appropriate conversion functions from GLib.Consult the GLib documentation at https://docs.gtk.org/glib/character-set.html for more information about the use case for this.
To minimize the impact on Java developers, all Java methods with Filename parameters that Java-GI generates, are overloaded with a String parameter. As a result, a Java developer can choose to pass a Filename or a regular String, depending on the situation. This also ensures backwards compatibility for most code that was written for earlier versions of Java-GI.