QString encoding problem
sonulohani last edited by sonulohani
I have a code in Qt5 which looks like this:-
Whenever I am converting it to C++ std::string using toStdString(), Its giving me invalid characters. I have tried all encoding and its not working at all. I have my Qt built with ICU libs. Please help me in this regard.
BTW if i print QString using qDebug() its printing ????
Tikani last edited by
What version of Qt5?
the problem is when you insert it this way the default encoding from the compiler/file is taken. Which is most probably not what you want for special characters.
Use the unicode escaping syntax to ensure the correct character data. e.g. "\uf02a" or whatever.
Whenever I am converting it to C++ std::string using toStdString(), Its giving me invalid characters.
how do you excactly check for those "invalid" characters?
sonulohani last edited by
@raven-worx Hi, thanks for the answer. And if i get \u**** output, how do i convert it into the character.
how do i convert it into the character.
what do you mean?
A "character" is just data. It just matters if you interpret it as a (Unicode-)character.
Thats why i asked how you exactly check for those "invalid" characters?