[Solved]how to convert this IRI to URI ?
-
how to convert this IRI to URI ?
http://down.qnwz.cn/uploads/media/broadcast/storymagazine/爱情的底牌.mp3
I hope the result type should be Qurl ,thanks
it seems that
@QUrl QUrl::fromEncoded ( const QByteArray & input )@
doesn’t work here .@
from PyQt4.QtCore import *
url='http://down.qnwz.cn/uploads/media/broadcast/storymagazine/爱情的底牌.mp3'
QUrl.fromEncoded (QUrl(url).toEncoded())
PyQt4.QtCore.QUrl('http://down.qnwz.cn/uploads/media/broadcast/storymagazine/爱情的底牌.mp3')@
-
try "QUrl::toPercentEncoding()":http://qt-project.org/doc/qt-5.0/qtcore/qurl.html#toPercentEncoding
-
[quote author="raven-worx" date="1371191655"]try "QUrl::toPercentEncoding()":http://qt-project.org/doc/qt-5.0/qtcore/qurl.html#toPercentEncoding[/quote]
it only return a QByteArray ,but I hope the result type should be Qurl -
IMO, if you can make sure that the string you passed to QUrl is a unicode string, then it will work.
For example, if you are using Python 2's shell under Windows platform, you can give a try to
@
QUrl('http://down.qnwz.cn/uploads/media/broadcast/storymagazine/爱情的底牌.mp3'.decode('gbk'))
@ -
[quote author="redstoneleo" date="1371198034"]
it only return a QByteArray ,but I hope the result type should be Qurl [/quote]
did you look at the example in the docs of this function?! -
[quote author="1+1=2" date="1371198201"]IMO, if you can make sure that the string you passed to QUrl is a unicode string, then it will work. For example, if you are using Python 2's shell under Windows platform, you can give a try to @ QUrl('http://down.qnwz.cn/uploads/media/broadcast/storymagazine/爱情的底牌.mp3'.decode('gbk')) @[/quote]
谢谢了,只不过我用的是python3
P.S.前辈您即能搞C++又能Python ,还是Qt已认证后的专家,高手也!!
我喜欢数学、物理、编程(主要是Python)、动漫、看杂志,有兴趣可以加QQ2281570025交流下。
-