5
J'ai un titre doc.at('head/title').inner_html
qui sort &
et il devrait être &
.Comment faire unescape HTML dans Nokogiri Ruby, so & reste & et non &
Mon document original est:
<head><title>Foo & Bar</title></head>
mais sort comme suit:
>> doc = Nokogiri::HTML.parse(file, nil, "UTF-8")
>> doc.at('head/title')
=> #<Nokogiri::XML::Element:0x..fdb851bea name="title" children=#<Nokogiri::XML::Text:0x..fdb850808 "Foo & Bar">>
>> doc.at('head/title').inner_html
=> "Foo & Bar"
Je ne veux pas utiliser Iconv ou CGI comme:
>> require 'cgi'
>> CGI.unescapeHTML(doc.at('head/title').inner_html)
=> "Foo & Bar"
c'est moche et incommode.