From 66a2d159073bfbeec53a0b9e09575c3fe9beac8d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 20 Oct 2018 21:28:17 -0700 Subject: QTextCodec: update the docs for codecForUtfText It can detect the standard UTF codecs, but not non-standard like UTF-7[1], UTF-9 or UTF-18[2]. [1] https://tools.ietf.org/html/rfc2152 [2] https://tools.ietf.org/html/rfc4042 Fixes: QTBUG-67188 Change-Id: If7e743cf8476463880ccfffd155f853dc947421a Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/codecs/qtextcodec.cpp | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index fedd39e104..a2a128158e 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -1164,9 +1164,19 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba) Tries to detect the encoding of the provided snippet \a ba by using the BOM (Byte Order Mark) and returns a QTextCodec instance - that is capable of decoding the text to unicode. If the codec - cannot be detected from the content provided, \a defaultCodec is - returned. + that is capable of decoding the text to unicode. This function can + detect one of the following codecs: + + \list + \li UTF-32 Little Endian + \li UTF-32 Big Endian + \li UTF-16 Little Endian + \li UTF-16 Big Endian + \li UTF-8 + \endlist + + If the codec cannot be detected from the content provided, \a defaultCodec + is returned. \sa codecForHtml() */ @@ -1209,8 +1219,19 @@ QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaul Tries to detect the encoding of the provided snippet \a ba by using the BOM (Byte Order Mark) and returns a QTextCodec instance - that is capable of decoding the text to unicode. If the codec - cannot be detected, this overload returns a Latin-1 QTextCodec. + that is capable of decoding the text to unicode. This function can + detect one of the following codecs: + + \list + \li UTF-32 Little Endian + \li UTF-32 Big Endian + \li UTF-16 Little Endian + \li UTF-16 Big Endian + \li UTF-8 + \endlist + + If the codec cannot be detected from the content provided, this overload + returns a Latin-1 QTextCodec. \sa codecForHtml() */ -- cgit v1.2.3