Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-17819

Problem with QFile::exists() (and QFileInfo::exists()) for localized filenames

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.7.1
    • Core: I/O
    • None
    • ARM embedded linux system+QtEmbedded, no locale support in system.

    Description

      There is a file with a non-English name("файл"): /mnt/external_a1/файл (filename in russian).

      This code demonstrates the problem: in console printed "0" => qt thinks file not exists.

      #include <QApplication>
      #include <QFileInfo>
      #include <QString>
      #include <QTextCodec>
      #include <stdio.h>
      
      int main(int argc, char **argv)
      {
      	QApplication app(argc, argv);
      	QString f;
      	QFileInfo fi;
      	QTextCodec *UTF8Codec=QTextCodec::codecForName("UTF-8");
      	QTextCodec::setCodecForCStrings(UTF8Codec);
      	f="/mnt/external_a1/файл";
      	printf("%d\n", QFile::exists(f));
      	return app.exec();
      }
      

      The problem appears after adding a row

      	QTextCodec::setCodecForCStrings(UTF8Codec);
      

      This line is needed for another code, but breaks this functionality.
      On the x86-desktop, this problem does not occur.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            earthdomain Earth Domain (Inactive)
            laborer Sergey Gusarov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes