-
Notifications
You must be signed in to change notification settings - Fork 26
fix: unicode filenames on Linux #54
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
Conversation
e4199ca
to
6392096
Compare
in this way, users of unrar.rs will get better DX and no need to call c method It took me hours to debugging this issue. But I think the core reason is that the unrar code from rarlab, has bug while dealing with I think we are good to merge this. |
Are you able to see the GitHub checks?
|
a9a1077
to
8f6450b
Compare
This bug caused CJK chars in filename to be stripped out on Linux. For example, `/media/mydisk/fooにほん.rar` would result in `/media/mydisk/foo` so the open will fail due to ```cpp if (r->ArcNameW!=nullptr && *r->ArcNameW!=0) ArcName=r->ArcNameW; else CharToWide(AnsiArcName,ArcName); Data->Arc.Open(ArcName,FMF_OPENSHARED) ``` in `Data->Arc.Open`, ArcName is converted with `WideToChar` causing the CJK bytes to get lost. So we pass it as AnsiArcName, so `CharToWide` is called first, causing to conversion to work. Co-authored-by: Danyel <vcs@danyel.io> Fixes #44
8f6450b
to
ca47917
Compare
@muja thanks for the second fixup. Just checked the code: unrar.rs/unrar_sys/vendor/unrar/file.cpp Lines 47 to 154 in e9c3101
so, if ArcNameW is null and ArcName is not null, rarlab code will do but for Windows, it does not goes to the for Linux and macOS: it calls CharToWide first (when ArcNameW is nullptr), when it does the reverse, it gets the right filename back. |
so here is the thing: for Windows, it is OK to set and use for macOS, it seems that any one of the above logic works fine. |
Thanks for the investigation. I changed the implementation only for |
PR created #57 |
This bug caused CJK chars in filename to be stripped out.
for example:
/media/mydisk/fooにほん.rar
will result in/media/mydisk/foo
so the open will faildue to
in
Data->Arc.Open
it will doWideToChar
which cause the CJK bytes got lost.but if it calls
CharToWide
first (whenArcNameW
is nullptr), when it does the reverse, it gets the right filename back.