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

yakczh · 2014年06月19日 · 2499 次阅读
# 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)

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号