From 38cba9a37fc5fe76b1549463422ab539a1b4cf24 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Thu, 2 Feb 2012 16:06:05 +0100 Subject: 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 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/corelib/codecs/codecs.pri | 1 + src/corelib/codecs/qiconvcodec.cpp | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index d0bafc3e74..c3a15ab4f9 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -38,6 +38,7 @@ unix { contains(QT_CONFIG,iconv) { HEADERS += codecs/qiconvcodec_p.h SOURCES += codecs/qiconvcodec.cpp + blackberry-*-qcc:LIBS_PRIVATE *= -liconv } else:contains(QT_CONFIG,gnu-libiconv) { HEADERS += codecs/qiconvcodec_p.h SOURCES += codecs/qiconvcodec.cpp 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 -- cgit v1.2.3