> > > 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.

The only other insight I can provide is that as I was debugging the issue I saw
the following: the degree symbol in the input file was an 0xc2b0 as reported
by the hex editor. Once I read that in a QString using a default QTextStream 
and looking at the string in Qt Creator's debug window is was an 0x00b0. 
Then if I wrote it out using a default QTextStream, it was written to the 
output 
file as just an 0xb0. Changing the output stream's codec to UTF-8 resulted in 
the output file containing 0xc2b0 like the original file.

Oh, and this is Qt 5.3.2 if that matters. I'm still stuck using an old Qt 
version
at this point.

Sean
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to