diff options
author | David Boddie <david.boddie@nokia.com> | 2011-07-18 13:02:45 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-07-18 13:02:45 (GMT) |
commit | b3922d06680c04324cecd0e0219d02c52b8cf7fd (patch) | |
tree | daf3045451271690cbb0543bfd04e7ffcb57f7e3 /src | |
parent | fd0e7f4aa75f1111eb094f35a3a8eb95d33ab0e3 (diff) | |
download | Qt-b3922d06680c04324cecd0e0219d02c52b8cf7fd.zip Qt-b3922d06680c04324cecd0e0219d02c52b8cf7fd.tar.gz Qt-b3922d06680c04324cecd0e0219d02c52b8cf7fd.tar.bz2 |
Doc: Moved general notes about character conversion.
Task-number: QTBUG-20411
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qurl.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index d551009..4226f9e 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -106,6 +106,19 @@ folding rules in QUrl conform to \l{RFC 3491} (Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)). + \section2 Character Conversions + + Follow these rules to avoid erroneous character conversion when + dealing with URLs and strings: + + \list + \o When creating an QString to contain a URL from a QByteArray or a + char*, always use QString::fromUtf8(). + \o Favor the use of QUrl::fromEncoded() and QUrl::toEncoded() instead of + QUrl(string) and QUrl::toString() when converting a QUrl to or from + a string. + \endlist + \sa QUrlInfo */ @@ -6514,16 +6527,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \o hostname becomes http://hostname \o /home/user/test.html becomes file:///home/user/test.html \endlist - - \section2 Tips to avoid erroneous character conversion when dealing with - URLs and strings: - - \list - \o When creating an URL QString from a QByteArray or a char*, always use - QString::fromUtf8(). - \o Favor the use of QUrl::fromEncoded() and QUrl::toEncoded() instead of - QUrl(string) and QUrl::toString() when converting QUrl to/from string. - \endlist */ QUrl QUrl::fromUserInput(const QString &userInput) { |