[Interest] Question about QTextStream and codecs

Thiago Macieira thiago.macieira at intel.com
Fri May 26 21:45:20 CEST 2017


On sexta-feira, 26 de maio de 2017 10:52:09 PDT Murphy, Sean wrote:
> > You should set the codec to UTF-8 in both the input and output
> > QTextStream.
> 
> Yeah, that is what I ended up doing since it certainly makes more
> sense to set it on both QTextStreams. I was just curious why the
> intermediate step where I was only setting the codec on the output
> stream got the result I wanted. I figured I would've needed to
> explicitly do it on both to have success.

That's what I'd expect too. The only explanation I have is that the 
QTextStream auto-detector did detect that the input was UTF-8, though if your 
file didn't have a BOM, I don't know how.

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




More information about the Interest mailing list