diff options
author | David Boddie <david.boddie@nokia.com> | 2011-07-18 15:02:45 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-26 05:56:22 +0200 |
commit | 6c588c52dacd5000f80a94b84b9cc979410b1427 (patch) | |
tree | 8e20fa7f0b8979b2077523ce1245b5dd4d102b81 /src/corelib/io/qurl.cpp | |
parent | 99324802dede39986bb467169c555c1b8ecde58f (diff) |
Doc: Moved general notes about character conversion.
Task-number: QTBUG-20411
(cherry picked from commit b3922d06680c04324cecd0e0219d02c52b8cf7fd)
Change-Id: If2730fa0d8abd6a14070bc19c8c307dbb61ca111
Reviewed-on: http://codereview.qt-project.org/1985
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Reviewed-by: Peter Yard <peter.yard@nokia.com>
Diffstat (limited to 'src/corelib/io/qurl.cpp')
-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 8e3c98c739..6dca036e05 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 */ @@ -6330,16 +6343,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) { |