summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-12-21 15:13:04 +0100
committerKai Köhne <kai.koehne@qt.io>2022-12-22 19:23:53 +0100
commitac6e61d867d76d0a24449f82c0f484a513fec184 (patch)
tree687071bcb0ef7638c8e8fe2b35e782f87479ef34 /src/corelib/io
parentc9d9b43b10509020be706629060f83fa3091c4c8 (diff)
Improve QFile::encodeName(), QFile::decodeName() documentation
Make it explicit that the local 8 bit encoding is UTF-8 on all platforms but Windows. Pick-to: 6.5 Change-Id: Icaabfd28689a71ee5cc2957f058f9388405496d5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfile.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index bb4a464017..585b5c8a1b 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -150,13 +150,11 @@ QAbstractFileEngine *QFilePrivate::engine() const
data and operator>>() to read it back. See the class
documentation for details.
- When you use QFile, QFileInfo, and QDir to access the file system
- with Qt, you can use Unicode file names. On Unix, these file
- names are converted to an 8-bit encoding. If you want to use
- standard C++ APIs (\c <cstdio> or \c <iostream>) or
- platform-specific APIs to access files instead of QFile, you can
- use the encodeName() and decodeName() functions to convert
- between Unicode file names and 8-bit file names.
+ \l{Input/Output and Networking}{Qt APIs related to I/O} use UTF-16 based
+ QStrings to represent file paths. Standard C++ APIs (\c <cstdio> or
+ \c <iostream>) or platform-specific APIs however often need a 8-bit encoded
+ path. You can use encodeName() and decodeName() to convert between both
+ representations.
On Unix, there are some special system files (e.g. in \c /proc) for which
size() will always return 0, yet you may still be able to read more data
@@ -322,10 +320,10 @@ QFile::setFileName(const QString &name)
/*!
\fn QByteArray QFile::encodeName(const QString &fileName)
- Converts \a fileName to the local 8-bit
- encoding determined by the user's locale. This is sufficient for
- file names that the user chooses. File names hard-coded into the
- application should only use 7-bit ASCII filename characters.
+ Converts \a fileName to an 8-bit encoding that you can use in native
+ APIs. On Windows, the encoding is the one from active Windows (ANSI)
+ codepage. On other platforms, this is UTF-8, for \macos in decomposed
+ form (NFD).
\sa decodeName()
*/