QT Qfile.exists returns false when existing file contains unicode chars
I have an application that uses QT c++ libs. One of the methods checks for the existance of a file before attempting to processes. The problem I have is the function returns false even when the file exists if there are unicode chars in the name.
The file name I am testing os
c:\هوoooooooooooooooहैFileName.mp4
The filename is passed as a command line arg
QFile fsrc(fileName);
if(!fsrc.exists()) //.exists() always returns false even if the file exists.
{
}
else
C++Linux
Last Comment
JonMny
8/22/2022 - Mon
jkr
Hm, how do you obtain the file name? And how are you checking/printing it? "c:\هوoooooooooooooooहैFileName.mp4" for sure looks suspicious...
JonMny
ASKER
The name of the file was made with these "bad" characters deliberately by our QA team. So, the file does exist and the name is as it appears. The application writes the file name to a log file using this name and it does match.
After looking at the code the .exists was in fact working. The application was calling an external application that was failing. The source file not found was a generic error that was thrown (regardless of the facts).
Thanks for the help for the record the code below works as expected.
QFile f("c:\هوoooooooooooooooहैFileName.mp4");
if ( f.exists() == false )