Re: [Development] qPrintable encoding issues

2014-02-28 Thread Matthew Woehlke
On 2014-02-28 11:46, Thiago Macieira wrote: > Another solution is to add another wrapper, like qPrintable, [...] Can I vote again for qRawUtf8? (Feel free to bikeshed the name; the point is that the implementation is .toUtf8.constData().) This would solve the printf case equally well *and* would

Re: [Development] qPrintable encoding issues

2014-02-28 Thread Thiago Macieira
Em sex 28 fev 2014, às 19:00:20, Olivier Goffart escreveu: > On Friday 28 February 2014 09:29:53 Thiago Macieira wrote: > > Em sex 28 fev 2014, às 18:09:36, Olivier Goffart escreveu: > > > > So: > > > > qDebug("%ls\n", qWPrintable(s)); > > > > > > That will not work because sizeof(wchar_t)

Re: [Development] qPrintable encoding issues

2014-02-28 Thread Olivier Goffart
On Friday 28 February 2014 09:29:53 Thiago Macieira wrote: > Em sex 28 fev 2014, às 18:09:36, Olivier Goffart escreveu: > > > So: > > > qDebug("%ls\n", qWPrintable(s)); > > > > That will not work because sizeof(wchar_t) is 4 on linux. > > (and QString::vsprintf wands %ls to be ushort*) > > Then

Re: [Development] qPrintable encoding issues

2014-02-28 Thread Thiago Macieira
Em sex 28 fev 2014, às 18:09:36, Olivier Goffart escreveu: > > So: > > qDebug("%ls\n", qWPrintable(s)); > > That will not work because sizeof(wchar_t) is 4 on linux. > (and QString::vsprintf wands %ls to be ushort*) Then we fix QString::vsprintf. We can use %S, which is an alias for %ls on r

Re: [Development] qPrintable encoding issues

2014-02-28 Thread Olivier Goffart
On Friday 28 February 2014 08:46:12 Thiago Macieira wrote: > Em sex 28 fev 2014, às 08:17:54, Thiago Macieira escreveu: > > Em sex 28 fev 2014, às 13:00:31, Koehne Kai escreveu: > > > > -Original Message- > > > > From: development-bounces+kai.koehne=digia@qt-project.org > > > > [...] >

Re: [Development] qPrintable encoding issues

2014-02-28 Thread Thiago Macieira
Em sex 28 fev 2014, às 08:17:54, Thiago Macieira escreveu: > Em sex 28 fev 2014, às 13:00:31, Koehne Kai escreveu: > > > -Original Message- > > > From: development-bounces+kai.koehne=digia@qt-project.org > > > [...] > > > qDebug("%ls", string.utf16()); > > > > This will actually not co

Re: [Development] qPrintable encoding issues

2014-02-28 Thread Matthew Woehlke
On 2014-02-28 04:16, Koehne Kai wrote: >> [...] >> What about adding e.g. qRawUtf8() which would do like qPrintable but >> toUtf8() instead of toLocal8Bit()? > > I've been pondering with this something similar too, since > > qDebug("%s", string.toUtf8().constData()); > > isn't really short and cris

Re: [Development] qPrintable encoding issues

2014-02-28 Thread Thiago Macieira
Em sex 28 fev 2014, às 13:00:31, Koehne Kai escreveu: > > -Original Message- > > From: development-bounces+kai.koehne=digia@qt-project.org > > [...] > > qDebug("%ls", string.utf16()); > > This will actually not compile with gcc, because we tell the compiler > explicitly we're printf-co

Re: [Development] qPrintable encoding issues

2014-02-28 Thread Koehne Kai
> -Original Message- > From: development-bounces+kai.koehne=digia@qt-project.org > [...] > qDebug("%ls", string.utf16()); This will actually not compile with gcc, because we tell the compiler explicitly we're printf-compatible: error: format '%ls' expects argument of type 'wchar_t*',

Re: [Development] qPrintable encoding issues

2014-02-28 Thread Koehne Kai
> -Original Message- > From: development-bounces+kai.koehne=digia@qt-project.org > > [...] > What about adding e.g. qRawUtf8() which would do like qPrintable but > toUtf8() instead of toLocal8Bit()? I've been pondering with this something similar too, since qDebug("%s", string.toUtf

Re: [Development] qPrintable encoding issues

2014-02-21 Thread Thiago Macieira
Em sex 21 fev 2014, às 10:48:18, Matthew Woehlke escreveu: > On 2014-02-21 04:20, Koehne Kai wrote: > > This is a heads up that you should avoid using qPrintable() together > > with qDebug/QDebug for localized strings. > > > > The issue is that qPrintable() does '.toLocal8Bit()', while > > QDebug/

Re: [Development] qPrintable encoding issues

2014-02-21 Thread Matthew Woehlke
On 2014-02-21 04:20, Koehne Kai wrote: > This is a heads up that you should avoid using qPrintable() together > with qDebug/QDebug for localized strings. > > The issue is that qPrintable() does '.toLocal8Bit()', while > QDebug/qDebug and friends nowadays expect const char * arguments to > be UTF-8

[Development] qPrintable encoding issues

2014-02-21 Thread Koehne Kai
Hi, This is a heads up that you should avoid using qPrintable() together with qDebug/QDebug for localized strings. E.g. qWarning("%s", qPrintable(tr("Localized error"))); is bound to break on some setups (e.g. Russian windows versions). The issue is that qPrintable() does '.toLocal8Bit()', whi