Special characters in strings stored in a QStringList
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:
Code:
in.setCodec("UTF-8");
// then in a loop while not at the end of the text file..
myStrList.append(line);
Appreciate any help! Thanks.
Re: Special characters in strings stored in a QStringList
Are You sure that codec UTF-8 is correct ? Maybe this file is in some 8-bit local codec ?
QStringList have nothing to this problem.
Re: Special characters in strings stored in a QStringList
Does "line" in line #8 contain a correctly decoded string? Please verify the string and not its output to the console using qDebug.