Hi,
I have to read unicode character of Indian Languages(Hindi/Telugu etc) from a file,
then i have to convert it in to the QString of actual text/font of that language.
While we are passing unicode manually it's working fine like following :
QString str
= QString::fromStdWString(L
"\u0926\u0947\u0935\u0928\u093e\u0970");
qDebug() << str; // It's printing actual font;
QString str = QString::fromStdWString(L"\u0926\u0947\u0935\u0928\u093e\u0970");
qDebug() << str; // It's printing actual font;
To copy to clipboard, switch view to plain text mode
But while we are trying to read unicode from file then not able to move ahead,
our requirement is like that :
QFile file(argv
[1]);
//argv[1] is file name we are passing on command line. {
fileText=out.readAll();
}
file.close();
qDebug()<<"data in the file:\n"<<fileText; // printing unicode character as it is in file;
// PROBLEM
std::wstring temp_text = fileText.toStdWString();
qDebug()<<"text:"<<test; // It's printing unicode character as, conversion not happening
QString fileText;
QFile file(argv[1]); //argv[1] is file name we are passing on command line.
QTextStream out(&file);
if(file.open(QIODevice::ReadOnly | QIODevice::Text))
{
fileText=out.readAll();
}
file.close();
qDebug()<<"data in the file:\n"<<fileText; // printing unicode character as it is in file;
// PROBLEM
std::wstring temp_text = fileText.toStdWString();
QString test = QString::fromStdWString(temp_text); // Not Working
qDebug()<<"text:"<<test; // It's printing unicode character as, conversion not happening
To copy to clipboard, switch view to plain text mode
My doubt is on fromStdWString() , In first case we are passing "L", what is this ?
And how to paas this "L" in fromStdWString(temp_text);
Thanks
Bookmarks