如果我将url http://www.äsdf.de/bla/bla放入QUrl中,那么如何用原始符号恢复url呢?
QUrl可以修复一些字符,但我希望在url中显示原始äsdf,而不是xn--sdf-pla。
我知道QString QUrl::fromAce(const QByteArray &domain),但它需要QByteArray而不是QUrl实例。
发布于 2016-11-18 12:26:58
可以将QUrl::toDisplayString与默认的PrettyDecoded格式选项或ComponentFormattingOption中的任何其他值一起使用。
QUrl url{"http://www.äsdf.de/bla/bla"};
QString original_string =
url.toDisplayString(); // default is QUrl::PrettyDecoded
QString original_string_with_encoded_spaces =
url.toDisplayString(QUrl::EncodeSpaces);https://stackoverflow.com/questions/40676682
复制相似问题