tags:

views:

163

answers:

2

Hi,

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 underscores, 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 :)

+1  A: 

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.

Job
Did not notice this changelog. It could be understood to follow the rules. I am even surprised that no other applications follow this strict way. And yes, mysinablog is unprofessional to allow this subdomain name, a headache for me now.
Cooy
A: 

I think it will be allowed again for one of the next versions: http://bugreports.qt.nokia.com/browse/QTBUG-7434

guruz