Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QTextStream>
- int main()
- {
- QTextStream out(stdout, QIODevice::WriteOnly);
- QTextStream in(stdin, QIODevice::ReadOnly);
- out << "Enter unicode char: " << flush;
- QString line = in.readLine();
- out << "Displays correctly: " << line << ", not the correct utf-8 code: " << line.toUtf8().toHex() << endl;
- in.setCodec("UTF-8");
- out.setCodec("UTF-8");
- out << "\nEnter unicode char: " << flush;
- line = in.readLine();
- out << "Displays correctly: " << line << ", possibly the correct utf-8 code: " << line.toUtf8().toHex() << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement