via server API's i'm getting contact information using member of structure:
char displayName[USERNAME_MAX_SIZE];
One of those names is a European name with special characters: "Per Spånt"
the structure of the displayName is as follows:
When I import 'displayName' into a QString via the "fromUtf8" function, I am getting the following QString:
How can I get the correct string into my QString without converting the special character into two weird characters?
FWIW, this is what works and doesn't work for me using Qt 4.7.4.
#include <iostream>
#include <string>
#include <QDebug>
#include <QString>
int main()
{
char name[7] = "Sp__nt";
name[2]=-61;
name[3]=-91;
std::cout << name << std::endl; // works
qDebug() << QString::fromUtf8( name ); // does not work
qDebug() << QString::fromAscii( name ); // works
qDebug() << QString::fromLatin1( name ); // works
qDebug() << QString::fromStdString( name ); // works
return 0;
}