[Interest] QFile::size() and QTextStream::pos()

Thiago Macieira thiago.macieira at intel.com
Fri Oct 30 00:55:58 CET 2015


On Thursday 29 October 2015 16:40:43 Thiago Macieira wrote:
> If you wanted to do a codec conversion with istream, you'd do it on top, not
> below. Note that wistream classes (like wifstream) don't convert from 8-bit
> to wchar_t: they read wchar_t from the input. I don't know how to convert
> from (say) UTF-8 to UTF-16 or UCS-4 with istream, so you'd probably have to
> implement this by yourself and you might find the unget() functionality
> useful to unread incomplete multibyte sequences.

Found something, if you're interested:

http://www.cplusplus.com/reference/codecvt/codecvt_utf8/#example

Unlike in Qt, the Standard Library std::locale includes QTextCodec and 
QTranslator functionality. But more importantly, I'd never have thought to 
search for "imbue" instead of "setlocale"...

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list