summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs/qiconvcodec.cpp
diff options
context:
space:
mode:
authorRafael Roquetto <rafael.roquetto@kdab.com>2012-02-02 16:06:05 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-03 13:14:06 +0100
commit38cba9a37fc5fe76b1549463422ab539a1b4cf24 (patch)
treecf3dadcc6852e3edcd41947743e1d3e6aef73927 /src/corelib/codecs/qiconvcodec.cpp
parentc802a5d272cde1f18a8debfb50b02ab1c682c2fc (diff)
Add support for QNX iconv implementation
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>
Diffstat (limited to 'src/corelib/codecs/qiconvcodec.cpp')
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index 98dc377a6f..1941b70f24 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -462,8 +462,13 @@ iconv_t QIconvCodec::createIconv_t(const char *to, const char *from)
iconv_t cd = (iconv_t) -1;
#if defined(__GLIBC__) || defined(GNU_LIBICONV)
+#if defined(Q_OS_QNX)
+ // on QNX the default locale is UTF-8, and an empty string will cause iconv_open to fail
+ static const char empty_codeset[] = "UTF-8";
+#else
// both GLIBC and libgnuiconv will use the locale's encoding if from or to is an empty string
static const char empty_codeset[] = "";
+#endif
const char *codeset = empty_codeset;
cd = iconv_open(to ? to : codeset, from ? from : codeset);
#else