Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, March 2008
Reading a text file of unknow encoding


Message 1 in thread

Hi,

I need to let my app read a text file of unknown encoding.  I had planned to
use QTextStream::readAll() but if the file is in iso8859-15, I just can't
get the accentuated characters. Any ideas ?

TIA

Alain

--
 [ signature omitted ] 

Message 2 in thread

denebet wrote:
>Hi,
>
>I need to let my app read a text file of unknown encoding.  I had
> planned to use QTextStream::readAll() but if the file is in iso8859-15,
> I just can't get the accentuated characters. Any ideas ?

To read a file of unknown encoding, you have two choices:

1) determine the encoding
2) ignore the encoding and use Latin1.

Qt does not provide a method for doing #1. You're on your own there.

As for #2, do not try to display the contents to the user, or the accents 
and other non-ASCII characters will show up wrong. You should make your 
transformations to the file and save it again.

-- 
 [ signature omitted ] 

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