-
Notifications
You must be signed in to change notification settings - Fork 282
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
Failed to open file with Cyrillic filename [msys2/clang64] #2229
Comments
Hi @eddiezato . I just tried to copy & paste the filename you gave as an example (
I worked in solving this issue few months ago. You can see the work done in this PR: #2090. You have mentioned that you are using Please let us know if you manage to handle your file correctly after the feedback provided. |
@piponazo thanks for your reply.
Yeah, I've read this and a couple of other topics. I use I've tried open the file without success on Windows 11 inside:
|
Build
$ exiv2/build/bin/exiv2.exe Darth-Vader-SW-Персонажи-Звездные-Войны-фэндомы-2304085.jpg
Darth-Vader-SW-╧хЁёюэрцш-╟тхчфэ√х-┬ющэ√-Ї¤эфюь√-2304085.jpg: Failed to open the file
the file has no exif, but at least it's loaded. |
Alright, let's try to hunt this issue together then 😇 . Juts as a piece proof that I was not lying before, I upload this screenshot showing how I can open a JPEG file which I renamed in my system with the filename you provided: At the moment, I think we are not using By the way, in your last comment you mentioned |
Did you build main inside MINGW64 environment/terminal (no unicode support) or UCRT64/CLANG64 for sure? Just setting CC=clang from MINGW64 will not work... I have the CLANG64 environment set up here and will try to reproduce shortly... |
Previously I was building with
It works fine:
Yep. 😉
Yeah, that's for sure: 2.9G ./clang64
1.4G ./home
0 ./ucrt64
0 ./mingw64
0 ./mingw32
0 ./clangarm64
0 ./clang32 |
Indeed, it (main 19dc566) doesn't work for me either currently: Same w/ UCRT64 build 😕 I haven't tried setting the system locale to UTF-8 yet. |
I'll try dig into this ASAP, but I am lately pretty busy with work and holidays. I'll probably take weeks before I can do some progress on this topic. |
Interestingly, UCRT64 does work from the default mintty+bash (i.e. what is used in CI): but doesn't from CLANG64 although it supposedly also links to ucrt... This will take time to figure out, could be missing flags to Clang on our part, could also be due to some MSYS2 CLANG64 libc++ configuration issue... |
@eddiezato Can you try removing -municode from |
cmd
msys2/clang64 user@host CLANG64 ~
$ exiv2/build/bin/exiv2.exe Darth-Vader-SW-Персонажи-Звездные-Войны-фэндомы-2304085.jpg
Darth-Vader-SW-: Failed to open the file |
Thanks. How about |
Same result. |
Thanks for checking, the search continues... I also tried removing |
I'm not an expert in c++. Just poke around in the code. 😜 So I found this: |
This might actually be the answer to the issue, so even though you might not be an c++ expert you did a good investigation around! 😁 When I have some spare time, I would like to: |
I made a simple program for testing: #include <iostream>
#include <filesystem>
#include <string>
namespace fs = std::filesystem;
using namespace std;
template <typename T> string f(T in) {
if (fs::exists(in))
return "exists ";
else
return "doesn't exists ";
}
int main() {
setlocale(LC_CTYPE, ".utf8");
string ss = "Darth-Vader-SW-Персонажи-Звездные-Войны-фэндомы-2304085.jpg";
fs::path ps = ss;
fs::path pu = fs::u8path(ss);
wstring ws = L"Darth-Vader-SW-Персонажи-Звездные-Войны-фэндомы-2304085.jpg";
fs::path pw = ws;
cout << "string " << f(ss) << ss << endl;
cout << "path from string " << f(ps) << ps << endl;
cout << "u8path from string " << f(pu) << pu << endl << endl;
cout << "wstring " << f(ws); wcout << ws; cout << endl;
cout << "path from wstring " << f(pw) << pw << endl;
} Then compiled it in user@host CLANG64 ~/123
$ clang++ -Wall -std=c++17 123.cpp -o 123clang
user@host UCRT64 ~/123
$ clang++ -Wall -std=c++17 123.cpp -o 123ucrt Output:
|
I opened a discussion in the msys2/mingw repo. The problem seems to be in libc++ itself, so I dunno if |
seems this was fixed upstream. No release yet though. I'll close here since the bug is in libc++. |
Describe the bug
$ exiv2 "Darth-Vader-SW-Персонажи-Звездные-Войны-фэндомы-2304085.jpg" Darth-Vader-SW-Персонажи-Звездные-Войны-фэндомы-2304085.jpg: Failed to open the file
To Reproduce
Build the latest version of exiv2 from
main
in themsys2/clang64
environment. My build script:Expected behavior
The program must be able to open a file with a Cyrillic filename.
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: