草庐IT

fromPercentEncoding

全部标签

c++ - 如何在 Qt 中对字符串进行转义?

我有以下示例:%3cahref%3d%22http://google.com%22%3eGoogle%3c/a%3e当未转义时,我希望它是:Google我试过:strUnescaped=QString::fromUtf8(strEncoded.toLatin1().data());但是结果和原来的不受影响不修改是一样的。我需要做什么? 最佳答案 您可能会使用QUrl::fromPercentEncoding将百分比解码为常规字符:QStringencodedStr="%3cahref='http://google.com'%3eGo