Skip to content

Fix Unicode paths on Windows (& accept more paths on Unix)#16

Open
yourname3 wants to merge 7 commits into
ebassi:masterfrom
yourname3:master
Open

Fix Unicode paths on Windows (& accept more paths on Unix)#16
yourname3 wants to merge 7 commits into
ebassi:masterfrom
yourname3:master

Conversation

@yourname3

Copy link
Copy Markdown

Hello,

I have run into #11 on my Windows machine. I believe this is because passing UTF-8 to the system file APIs simply does not actually work for Windows, and so calling taglib_file_new and taglib_file_new_type fails as well.

Instead, this pull request makes it so on Windows, the Paths are encoded in UTF-16/WTF-16, and passed through taglib_file_new_wchar and taglib_file_new_type_wchar (two bindings that only exist on Windows).

I also tweaked the Unix code for taglib_file_new and taglib_file_new_type to avoid the intermediate conversion to UTF-8, as other paths than pure UTF-8 should be valid on Unix platforms as well.

Finally, I change the API for File::new_type to take a P: AsRef<Path> argument for its filename, rather than just an &str (to make the code more consistent). This should probably be considered a breaking change; perhaps I should have bumped the semver.

Depending on if/when this is able to be merged, if anyone else just needs a quick fix for Unicode on Windows, you can patch in my fork:

[patch.crates-io]
taglib = { git = "https://github.com/yourname3/taglib-rust.git" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant