I would really like to be able to do the following. Is this even
possible?
Thanks,
nerdytenor
uri = URI.parse('http://www.hören.com') # not a real url (that I know
of)
URI::InvalidURIError: bad URI(is not URI?): http://www.hören.com
from /usr/lib/ruby/1.8/uri/common.rb:432:in `split'
from /usr/lib/ruby/1.8/uri/common.rb:481:in `parse'
from (irb):26
I would really like to be able to do the following. Is this even
possible?
Thanks,
nerdytenor
uri = URI.parse('http://www.hören.com') # not a real url (that I know
of)
URI::InvalidURIError: bad URI(is not URI?): http://www.hören.com
from /usr/lib/ruby/1.8/uri/common.rb:432:in `split'
from /usr/lib/ruby/1.8/uri/common.rb:481:in `parse'
from (irb):26
http://www.h%C3%B6ren.co
/usr/lib/ruby/1.8/uri/generic.rb:194:in `initialize': the scheme http
does not accept registry part: www.h%C3%B6ren.co (or bad hostname?)
(URI::InvalidURIError)
from /usr/lib/ruby/1.8/uri/http.rb:46:in `initialize'
from /usr/lib/ruby/1.8/uri/common.rb:484:in `new'
from /usr/lib/ruby/1.8/uri/common.rb:484:in `parse'
from r3test.rb:7
which as far as I can tell means that URI.parse() is broken.
I would really like to be able to do the following. Is this even
possible?
Thanks,
nerdytenor
uri = URI.parse('http://www.hören.com') # not a real url (that I know
of)
URI::InvalidURIError: bad URI(is not URI?): http://www.hören.com
from /usr/lib/ruby/1.8/uri/common.rb:432:in `split'
from /usr/lib/ruby/1.8/uri/common.rb:481:in `parse'
from (irb):26
There is no such thing as a Unicode URL. The RFC for URI and URL specify the charset as 7Bit ASCII AFAIK.
http://www.h%C3%B6ren.co
/usr/lib/ruby/1.8/uri/generic.rb:194:in `initialize': the scheme http does not accept registry part: www.h%C3%B6ren.co (or bad hostname?) (URI::InvalidURIError)
from /usr/lib/ruby/1.8/uri/http.rb:46:in `initialize'
from /usr/lib/ruby/1.8/uri/common.rb:484:in `new'
from /usr/lib/ruby/1.8/uri/common.rb:484:in `parse'
from r3test.rb:7
which as far as I can tell means that URI.parse() is broken.
I don't think so. There are invalid characters in the domain name (as the exception indicates).
According to wikipedia, all those characters are valid for a uri.
They are but host & domain names do not accept Unicode characters at all and are limited to 7 bits ASCII. Search for IDN for more information.
--
Ollivier ROBERT -=- EEC/RIF/SEU -=-
Systems Engineering Unit
It says that what characters are valid for each piece of a URI is dependent on the URI scheme. The characters valid for the hostname part of the http URI scheme is goverened by the DNS system, so you need to use an IDN.
I believe there is a ruby wrapper for libidn.
···
On Sep 20, 2007, at 24:31 , 7stud -- wrote:
Robert Klemme wrote:
which as far as I can tell means that URI.parse() is broken.
I don't think so. There are invalid characters in the domain name (as
the exception indicates).
That's because Firefox automatically translates into the equivalent IDN;
attempting to lookup the domain www.hören.at (or hören.at) gives
NXDOMAIN - it will never work. www.hören.at is translated into the
punycode name www.xn–hren-5qa.at. Try visiting that in Firefox - it
actually rewrote the URL as www.hören.at for me, but rest assured the
domain is one and the same.
7 bit ASCII is to be used in domain names only; please use IDN to
represent international characters, as it's the accepted way to do it,
and implemented as you see in Firefox.