小编Ami*_*esh的帖子

’ 在轨道上的红宝石中被nokogiri转换为"\ u0092"

我有html页面,其中包含一些html实体,如"’".

#Here I am not pasting whole html page content. just putting issue line only
html_file = "<html>....<body><p>they&#146;re originally intended to describe the spread of of viral diseases, but they&amp;#146;re nice analogies for how web/SN apps grow.<p> ...</body></html>"


doc   = Nokogiri::HTML(html)
body  = doc.xpath('//body')
body_content = body[0].inner_html

puts body_content  
Run Code Online (Sandbox Code Playgroud)

结果:

These terms come from the fields of medicine and biology  they\u0092re originally intended to describe the spread of of viral diseases, but they\u0092re nice analogies for how web/SN apps grow. …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails nokogiri

8
推荐指数
1
解决办法
2980
查看次数

标签 统计

nokogiri ×1

ruby ×1

ruby-on-rails ×1