summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs
Commit message (Collapse)AuthorAgeFilesLines
* Exclude QIcuCodec when QT_NO_TEXTCODEC is definedJ-P Nurmi2012-09-162-0/+8
| | | | | | | Change-Id: Iec0178c427abcc1c79e4fe6ef449d399ac8ca363 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* checkForCodecs is not used when QT_LOCALE_IS_UTF8 is definedJiang Jiang2012-09-021-1/+1
| | | | | | Change-Id: I3d82863cbd123dbf73eb8f5721ef9294e6365de6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Force QT_NO_ICONV on win32:!win32-msvc*Lukas Geyer2012-08-311-1/+1
| | | | | | | | | | | | This behaviour was changed in Ide9800f6 to suppress macro redefinition warnings for MSVC, but MinGW has iconv support and therefore configure does not set QT_NO_ICONV, which prevents compilation on win32-g++ as QIconvCodec does not support Windows. Change-Id: Ic3c4ccceb3eaf9542c95b0c27847ca5ab51849b7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* Don't define QT_NO_ICONV on Windows: that comes from qconfig.hThiago Macieira2012-08-251-1/+1
| | | | | | | | | | | | Both the configure script and configure.exe add QT_NO_ICONV to qconfig.h in case they can't find iconv. Since Windows doesn't use iconv anyway, we don't need to set QT_NO_ICONV here. MSVC likes to print a warning that a macro is redefined. That gets quite spammy... Change-Id: Ide9800f6f848bc0c2d8bdbcb41875a709d3e249c Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-239-0/+14
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* ICU: Fix crash in codecForMib(2107)Kai Koehne2012-08-231-0/+4
| | | | | | | | | | | | availableMibs() unconditionally adds 2107 to the list of mibs. The patch ensures that codecForMib() also knows about this special TSCII codec. (Note that the autotest only really checks this code path if only this test case is run. The other tests already fill the internal codec cache otherwise). Change-Id: Id987d7cecd5f5700cca75e9b85b37011f8e5c622 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Make the "\internal" qdoc command stand on its own lineLaszlo Papp2012-08-153-24/+70
| | | | | | | | | | The qdoc manual currently claims that the command must stand on its own line. The change follows the consistency with the rest and how the example looks like inside the qdoc manual for this command. Change-Id: I6b653dc95cf9d84e4adf32220dace5d313678419 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Make sure codecForLocale returns a valid codec in bootstrap modeJan-Arve Saether2012-08-061-1/+1
| | | | | | | | | This was a regression caused by acbfb4d777474aadd2813614108, causing for instance qdoc to crash. Change-Id: Id8daa19d467c4f1729e5a5a203a388f16ec4a6de Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* ICU: lock the mutex before calling an Unlocked functionThiago Macieira2012-08-041-0/+2
| | | | | | | | | | | | | The QIcuCodec::defaultCodecUnlocked function is not thread-safe because it calls codecForNameUnlocked. In turn, that one accesses and even modifies a QHash stored in the QCoreGlobalData singleton, which is what makes it non-threadsafe. In order to call the Unlocked function, we need to lock the mutex first. Change-Id: I915570110229f4c0929986aa26731244317ef6ab Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* ICU: Mark which functions are threadsafe and which ones aren'tThiago Macieira2012-08-043-14/+20
| | | | | | | | | | | | | Mark the thread-safe functions with the \threadsafe doc marker. This includes public API, which should be thread-safe anyway. The thread-unsafe functions are marked "\nonreentrant" already. In addition, I renamed the functions that must be called with locked mutexes to Unlocked, following the convention in other libraries like libdbus-1. Change-Id: Ibd93d1266149767f546c8e82959b73c138008469 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Align the CP949 codec name with ICULars Knoll2012-07-312-6/+9
| | | | | | | | It's name is windows-949 according to ICU. Keep CP949 as an alias for compatibility with Qt 4. Change-Id: I115ba2593da6f7b47e25136c3fadb19c7f798ff0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Small doc fixes about the list of supported codecs.Lars Knoll2012-07-311-3/+3
| | | | | Change-Id: I98b8ec9d5de9e69f1bb6187b4d820d61f7ce03e5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Do not preload any codecs anymore when using ICULars Knoll2012-07-314-30/+81
| | | | | | | | | When using ICU we can now avoid pre loading any codecs at startup. Instead QTextCodecs will always be created lazily when first asked for. Change-Id: Ic668f2824700896d2eca7d0de54f978404826163 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a factory method to QIsciiCodec and fix the namesLars Knoll2012-07-312-9/+21
| | | | | | | | | Make the names all lower case to be in line with what ICU reports. Add a factory method to create the codecs according to their name. Change-Id: Ia3dddaa7701a0645d9d8fbcb52f1f8d58f79cf98 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use ICU instead of iconv/windows codecs for the localeLars Knoll2012-07-314-35/+50
| | | | | | | | With ICU there's no need to use the windows locale or iconv codecs anymore as locale codecs. Change-Id: I50c94a97ed6acbf4c6f05b2a88593a57ebfa8342 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make codecForLocale atomicLars Knoll2012-07-311-36/+35
| | | | | Change-Id: I8017b1c2aa1df8d613e83919a945fd5f320713d6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* ICU code page conversion supportLars Knoll2012-07-314-24/+790
| | | | | | | | | | | | | Use ICU to do code page conversion instead of the builtin text codecs. With this QTextCodec simply becomes a wrapper around ICU's ucnv_* methods. We only keep our own codecs for UTF-*, ISO-8859-1, ISO-8859-15 for performance reasons, and for TSCII and iscii-* because they aren't supported by ICU. Change-Id: I4fc49eba55cf772b9772c6dac606a47a44346a60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename some codecs to be in line with ICULars Knoll2012-07-311-2/+2
| | | | | Change-Id: If523d2a12ef64c79e3860da1f430f128d24ff600 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Disable iconv on utf-8 based platformsLars Knoll2012-07-312-4/+5
| | | | | | | | | There's no need to use iconv on Mac, iOS, Android or QNX, as all these platforms are fully utf-8 based. Change-Id: I2a03c8dea72ad91f6ec83da0a838de20e46babef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Lazily initialize iconv in the iconv codecLars Knoll2012-07-312-4/+12
| | | | | | | | | | | | | | | Avoid dlopen'ing libiconv and initializing it's members until the codec gets used for the first time. This avoids some memory and startup time overhead in case we can use the utf8 codec instead of iconv. It also removes a circular dependency between codec initialization during app startup. Change-Id: I119c010c288dc59ab32279d8a213ae1f4347cace Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use utf-8 as the locale codec where it makes senseLars Knoll2012-07-311-6/+8
| | | | | | | | | Use utf8 as the fallback codec in case we can't determine something else instead of latin1. Also use utf8 for Mac, iOS, Android and QNX. Change-Id: I15dc85d2406b1ebdfacff25f45f8b6854c52b97e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove encoding detection according to LANGLars Knoll2012-07-311-142/+0
| | | | | | | | | This code is left over from the 90's, and should not get used anymore. In all relevant cases we will use UTF-8 or iconv nowadays. Change-Id: Ie3776f671de33f782fa77f6359bf6e105bd9c1b8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move the text codec list to qcoreglobaldata.Lars Knoll2012-07-312-195/+90
| | | | | | | | | | | This removes some global statics in QTextCodec and makes the code better to maintain in the longer term. Remove QT_NO_THREAD defines around mutexes as this isn't required in Qt 5 anymore. Change-Id: I15ede75f53b16f134f4053f3188c4b47e86fcd8a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move the windows locale codec into it's own fileLars Knoll2012-07-234-217/+330
| | | | | | | | | Simple cleanup, that will make it easier to refactor the code to use ICU. Change-Id: I7486f36d27b8c521cf970327eb94b2236338d4ec Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
* Remove the font codecsLars Knoll2012-06-2512-902/+2
| | | | | | | | These codecs have only been used for XLFD based fonts. These are not supported anymore by Qt 5. Change-Id: I7dc083f2efcd42363b144b24bd62c169d83390cf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* The codecForTr() should be utf8Lars Knoll2012-06-251-1/+1
| | | | | | | | tr() assumes utf8 as input encoding, not latin1. Change-Id: If834f8c169bdb431d78713d14b03542d3a7ca8e4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* define QT_NO_ICONV if QT_NO_TEXTCODECJeremy Katz2012-06-201-0/+4
| | | | | | | | | | | | This also updates qfeatures.h with various other things that have been neglected. Run $QTSRCDIR/util/scripts/make_qfeatures_dot_h after changing qfeatures.txt Task-number: QTBUG-24816 Change-Id: I18b71fcec71efa9cfe3425fb1a7833456ec411b9 Reviewed-by: Tasuku Suzuki <tasuku.suzuki@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* disable codecs for asian language when QT_NO_BIG_CODECS definedTasuku Suzuki2012-06-1423-56/+65
| | | | | Change-Id: I45025b13bacc5f63946b02a87c742beff1946c0b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QtCore: remove \link usagesGiuseppe D'Angelo2012-05-292-8/+7
| | | | | Change-Id: I0de764b51a972de0b6eb2bf3c04d2b190f581f52 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Avoid using iconv for text conversion where possibleLars Knoll2012-05-162-38/+29
| | | | | | | | | | | | Try to use a builtin codec as codecForLocale() if possible first. Fall back and instantiate the iconv codec only if that failed. In addition, make sure we initialize the locale correctly before we try to setup the codec. Change-Id: I86d635f9d11e8ff93093f162e79fb37f3d85731b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QChar: add isSurrogate() and isNonCharacter() to the public APIKonstantin Ritt2012-05-161-4/+3
| | | | | | | | + QChar::LastValidCodePoint enum value that supercede the UNICODE_LAST_CODEPOINT macro replace uses of hardcoded values with the new API; remove leftovers Change-Id: I1395c9840b85fcb6b08e241b131794a98773c952 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* add some useful methods to QUnicodeTables::Konstantin Ritt2012-05-101-15/+3
| | | | | | | in order to reduce code duplication and prepare the ground for upcoming changes Change-Id: I980244149f65384c9484bbec4682de8b7b848b08 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add Android to conditionals around langinfo.h usage.Robin Burchell2012-05-041-3/+5
| | | | | | | | Despite being mandated by POSIX, Android does not support this. Change-Id: I3da42ff9b3336cb6657692a9eb70dd3118ac1756 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-192-10/+10
| | | | | | | | | | | | This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* replace hardcoded values with a surrogate handling methodsKonstantin Ritt2012-04-131-3/+3
| | | | | | Change-Id: Ib41e08d835f2e8ca2e32b4025c6f5a99840f2e27 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* fix QUtf8 codec to disallow codes in range [U+fdd0..U+fdef]Konstantin Ritt2012-04-111-1/+1
| | | | | | | | | 0xfdef-0xfdd0 is definitely 31 and not 15 :) also fix all copy-pastes of this code (greping for '0xfdd0' helps ;) Change-Id: I8f3bd4fd9d85f9de066f0f5df378b9188c12bd48 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
* Fix scopes on iconv related pro/pri filesRafael Roquetto2012-03-271-1/+1
| | | | | | | | | Ensure corelib and the iconv configure test link against libiconv on QNX-based platforms. This now includes the Blackberry mkspecs which were previously excluded. Change-Id: I60677ab8506b7cf47f504b880bb1078036984e85 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Restore some source compatibilityLars Knoll2012-03-121-0/+4
| | | | | | | | | | | Add an implicit #include back in to avoid needless SC and compilation breaks. Add some deprecated method for codecForTr, until all other modules are ported to mot use it anymore. Change-Id: I5334b47a0c32819b9eb6b7203cc98ce4e6073a64 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Updated codecs.pri to reflect new QNX mkspec nameRafael Roquetto2012-03-091-1/+1
| | | | | Change-Id: Icd4a9dd774991c2be180b885b3892ff85a3f8dc1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fixes wrong iconv_open call under QNXRafael Roquetto2012-03-091-1/+1
| | | | | | | | | | The wrong macro logic was causing iconv_open to never be called under QNX. Change-Id: I3367872fc8440f87fb59667770acd06262aef723 Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fixes mismatching delete operatorRafael Roquetto2012-03-091-1/+1
| | | | | | Change-Id: Ib6640daa0fdd12f98f9d7e257c226e0abdcf31dc Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Fixes potential memory leak in qtextcodec.cppNick Ratelle2012-03-081-17/+9
| | | | | Change-Id: I56c0a1a6cc261bd15653bc4cbb94daed1f8aa811 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove codecForTr().Robin Burchell2012-03-062-44/+0
| | | | | | | | | | Similarly to change id I2f429fa7ef93bd75bb93a7f64c56db15b7283388, the capability to arbitrarily alter the encoding of literals is very destructive, especially in a world with libraries and plugins. Change-Id: If0d4cd8dcf89792e39c1984cbde6b036cebfc02f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-03-041-3/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: dist/changes-5.0.0 mkspecs/features/qt_module_config.prf qmake/project.cpp qmake/property.cpp Change-Id: I6e4af40743a9aeff8ed18533a48036e332acc296
| * Merge master -> api_changesRohan McGovern2012-02-292-34/+1
| |\ | | | | | | | | | | | | | | | Includes fixes for tst_qfiledialog2, tst_qtextedit autotests on mac. Change-Id: I49cac26894d31291a8339ccc1eb80b6a940f0827
| * | QByteArray: deprecate QT_NO_CAST_FROM_BYTEARRAY-protected operatorsMarc Mutz2012-02-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QByteArray::operator const {char,void}*() implicit conversions are a source of subtle bugs, so they right- fully can be disabled with QT_NO_CAST_FROM_BYTEARRAY. const char *d = qstring.toLatin1(); // implicit conversion while ( d ) // oops: d points to freed memory // ... But almost no-one ever enabled this macros in the wild and many were bitten by these implicit conversions, so this patch deprecates them. I would have liked to remove them completely, but there are just too many occurrences even in Qt itself to hope to find all conditionally-compiled code that uses these. Also fixes all code that needs to compile under QT_NO_DEPRECATED (in qmake/, src/tools/). I984706452db7d0841620a0f64e179906123f3849 separately deals with the bulk of changes in src/ and examples/. Depends on I5ea1ad3c96d9e64167be53c0c418c7b7dba51f68. Change-Id: I8d47e6c293c80f61c6288c9f8d42fda41afe2267 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | | Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-022-71/+71
| |/ |/| | | | | | | | | | | | | | | | | | | QDoc now has support for Doxygen style commands for italics, bold and list items. This change applies that change in QDoc to the actual documentation. Task-number: QTBUG-24578 Change-Id: I519bf9c29b14092e3ab6067612f42bf749eeedf5 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Remove custom text codec for C strings.Robin Burchell2012-02-222-34/+1
|/ | | | | | | | | | This setting is extremely harmful, as code cannot know whether or not to expect it. It also made the behaviour of QString::fromAscii and ::toAscii unintuitive, and caused a lot of people to make mistakes with it. Change-Id: I2f429fa7ef93bd75bb93a7f64c56db15b7283388 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fixes QIconvCodec::convertToUnicode()Nick Ratelle2012-02-052-1/+6
| | | | | | | | | | We need to hang onto the internal state of the utf16 converter object whenever converting a long string to unicode. This was failing with the text stream class -- the first read was okay, but subsequent reads could not be correctly converted to unicode. Change-Id: I9e2d445d51c9009591bfa7a1765ea2d09ae634a2 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add support for QNX iconv implementationRafael Roquetto2012-02-032-0/+6
| | | | | | | | | | | QNX implements the POSIX version of iconv (with non-const function signatures). However, it is still necessary to link with libiconv, unlike most cases. Also, its iconv_open does not know how to handle an empty string. Change-Id: I8654703e46b9c64503aca5521ce7fae1c97d7968 Reviewed-by: Mark Brand <mabrand@mabrand.nl> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>