标签:http 数据 work window array 使用 cti utf8编码 中文
QNetworkAccessManager *manager = new QNetworkAccessManager(this);; QNetworkRequest network_request; QByteArray post_data; network_request.setUrl(QUrl("http://109.26.149.57:8080/tsinghuaVC/init/selectAllFolder.action")); network_request.setHeader(QNetworkRequest::UserAgentHeader,"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.4098.3 Safari/537.36"); connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*))); //发送请求 manager->get(network_request); void replyFinished(QNetworkReply* reply) { QTextCodec *codec = QTextCodec::codecForName("utf8"); //使用utf8编码,这样才可以显示中文 QString all = codec->toUnicode(reply->readAll()); qDebug() << "= " << all; reply->deleteLater(); //最后要释放reply对象 }
标签:http 数据 work window array 使用 cti utf8编码 中文
原文地址:https://www.cnblogs.com/herd/p/11867803.html