开发者

QUrl does not parse host name with underscore

Today I found that in Qt 4.6, QUrl would not parse a url if the host name contains the underscore.

I understand that according to the standard, underscore is not allowed in the domain name, however, there ARE some urls with undersco开发者_如何学JAVAres, especially for some subdomain.

For example, i came across this feed's url:

http://hero_hki.mysinablog.com/rss.php

and QUrl("http://hero_hki.mysinablog.com/rss.php").toString() returns "http:/rss.php"

Firefox and Google Chrome can access this page anyway.

(I tested with Qt 4.6 tp1. Not so sure whether this issue is fixed in the release, cuz I did not have time to compile the release version on my laptop for developing my toy feed reader.)

Any advice? Thanks :)


I read the following from Qt 4.6.0 changelog:

QUrl's parser is more strict when for hostnames in URLs. QUrl now enforces STD 3 rules:

  • each individual hostname section (between dots) must be at most 63 ASCII characters in length;

  • only letters, digits, and the hyphen character are allowed in the ASCII range; letters outside the ASCII range follow the normal IDN rules

That means QUrl no longer accepts some URLs that were invalid before, but weren't interpreted as such.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜