plugin/puboo.rb in tdiary-contrib-5.0.4 vs plugin/puboo.rb in tdiary-contrib-5.0.5
- old
+ new
@@ -32,11 +32,11 @@
if !@conf.secure and !(result = puboo_cache_get(id)).nil?
return result
end
link = "http://p.booklog.jp/book/#{id}"
- doc ||= open( link ).read
+ doc ||= open( link ).read.force_encoding('UTF-8')
title = doc.match(%r|<meta property="og:title"\s*content="(.*)"|).to_a[1]
image = doc.match(%r|<meta property="og:image"\s*content="(.*)"|).to_a[1]
price = doc.match(%r|<th class="th_2">価格</th>.*?<span>(.*?)</span>.*?<br />|m).to_a[1]
author = doc.match(%r|<th>作者</th>(.*?)</td>|m).to_a[1].gsub(/<.*?>/, '').strip
@@ -53,10 +53,10 @@
</span></a>
EOS
puboo_cache_set( id, result ) unless @conf.secure
result
-rescue
+rescue
link
end
if __FILE__ == $0
require 'test/unit'