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.
http://www.h%C3%B6ren.co
url = “http://www.hören.co”
(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.
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.
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.
Cheers.
Arlen
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.