数据中有类似<span>hello</span>这种被编码过的html片段,用htmlentities这个gem可以解码。
?
安装:
gem install htmlentities
解码示例:
require 'htmlentities' coder = HTMLEntities.new string = "<span>hello</span>" coder.decode(string) # => <span>hello</span>