On terça-feira, 21 de fevereiro de 2012 18.28.44, Marc Mutz wrote:
> It does use QLocale methods for formatting, and it supports the l modifier
> to %s. For a port to QByteArray, we'd need to define what encoding to
> assume  (QString expects utf-8 on input, and we'd keep that, but we need to
> decide which encoding to _output_).

Do you mean for the following code?

        QString().sprintf("%ls", otherqstring.utf16())

I didn't know that was possible until you mentioned it. I doubt many people
are using it. Note that it's also different from the real printf's %ls, which
expects wchar_t*, not ushort*.

Changing to QByteArray would mean assuming an encoding *if* we keep our own
code. I'd much rather this used vasprintf and let the system deal with it. (In
that case, wide strings would be converted using an equivalent of
toLocal8Bit()).

This is a source of subtle bugs, so I'm going to drop the proposal. Just make
the functions static and we'll work on a proper C++11 replacement later.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to