diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-04-28 12:08:59 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-05-04 13:34:03 (GMT) |
commit | 7031e1d110bb1bc97cfe0377adc211030e1e7320 (patch) | |
tree | b1260d28e0865eaab3c91f1330a1df0dca2ba858 /src/corelib/codecs/qtextcodec.h | |
parent | 1e0e67406c3865717fef8b98d2c69adbefc54245 (diff) | |
download | Qt-7031e1d110bb1bc97cfe0377adc211030e1e7320.zip Qt-7031e1d110bb1bc97cfe0377adc211030e1e7320.tar.gz Qt-7031e1d110bb1bc97cfe0377adc211030e1e7320.tar.bz2 |
When data was copied from Mozilla Firefox to Qt, the text format was not valid.
Mozilla encodes the text/html format in UTF16 and adds a BOM, however
it doesn't specify the charset in the html header. The fix is to guess
the encoding by either charset in the html header or BOM for text/html
format, or by BOM for non html formats.
This commit adds a new public function QTextCodec::codecForUtfText() which
can be used to guess encoding out of the BOM.
Task-number: 250555
Reviewed-by: Benjamin Poulain
Reviewed-by: Simon Hausmann
Reviewed-by: Andreas Aardal Hanssen
Diffstat (limited to 'src/corelib/codecs/qtextcodec.h')
-rw-r--r-- | src/corelib/codecs/qtextcodec.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h index e32650f..83097a5 100644 --- a/src/corelib/codecs/qtextcodec.h +++ b/src/corelib/codecs/qtextcodec.h @@ -82,6 +82,9 @@ public: static QTextCodec *codecForHtml(const QByteArray &ba); static QTextCodec *codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec); + static QTextCodec *codecForUtfText(const QByteArray &ba); + static QTextCodec *codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec); + QTextDecoder* makeDecoder() const; QTextEncoder* makeEncoder() const; |