Ruby `gsub': invalid byte sequence in GBK (ArgumentError)

yakczh · June 19, 2014 · 2500 hits
# encoding: UTF-8
require 'hpricot'
content='''
<td class="t_f" id="postmessage_33396">
<strong><a href="http://s3.envato.com/files/339088/index.html" target="_blank"><font color="#6466b3">AVIASLIDER – jQuery Slideshow</font></a></strong><br />

</td>

'''
xpath='//strong/a/font'

doc = Hpricot(content)



doc.search(xpath).each do |td|
      #print td['href'],"\t", td.inner_text,"\n"
        puts  td.inner_text
end 

文件保存是另存为 utf8 这样保存的,怎么会提示 GBK (ArgumentError)

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.