Hello,

I have an application that gets a list of names from a text file and store those names in a QStringList. Afterwards, I use that list to access certain items of a QHash that have the names stored in my QStringList as their keys. The problem I am having is that some of the names might have special characters such as é, à , ù, etc.

So when this is the case I realized that when a name such as "Jérémy" for example, this name gets stored in the QStringList as "J?r?my" so when I want to access the item which has as key "Jérémy", my QHash it doesn't find the item.

How can I make the QStringList store the names with special characters correctly ? When reading from the text file to the QStringList I am doing:

Qt Code:
  1. QFile file(name);
  2. file.open(QIODevice::ReadOnly | QIODevice::Text);
  3.  
  4. QTextStream in(&file);
  5. in.setCodec("UTF-8");
  6.  
  7. // then in a loop while not at the end of the text file..
  8. QString line = in.readLine();
  9. myStrList.append(line);
To copy to clipboard, switch view to plain text mode 


Appreciate any help! Thanks.