I would like to convert a QString containing Unicode characters to plain HTML text. For instance "ç§" would become "&" followed by "#31169;" (couldn't display it in a single string).
Is there such a functionality in Qt? I found the function QString Qt::escape ( const QString & plain ) but it only converts HTML metacharacters <, >, &, and ".
Waiting for a better way, I tried to write my own encoding function:
Qt Code:
QString chr; for (int i = 0; i < str.size(); ++i) { } return list.join(""); }To copy to clipboard, switch view to plain text mode
It almost works. It works for ASCII characters but when I try it with other Unicode characters I only get Korean characters. Why? I feel there's not much to change but I don't know what. Also, any improvement of my code would be appreciated.
Bookmarks