irb(main):010:0> URI("http://www.baidu.com/xEA\xE6").host
ArgumentError: invalid byte sequence in UTF-8
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/uri/common.rb:125:in `==='
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/uri/common.rb:125:in `split'
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/uri/common.rb:211:in `parse'
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/uri/common.rb:747:in `parse'
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/uri/common.rb:994:in `URI'
from (irb):10
from /usr/lib64/fluent/ruby/bin/irb:12:in `<main>'
ruby 版本
/usr/lib64/fluent/ruby/bin/ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
我需要获取这种情况下的 host,遇到这个问题。网上搜了好久没找到合适的资料,哪位大大遇到过帮看看,在此感谢