Skip to content

Commit

Permalink
Fix for invalid byte sequence in UTF-8
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian committed Jan 17, 2012
1 parent 6dc91b2 commit 8f61457
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/mms2r/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ def subject
def body
text_file = default_text
@body = text_file ? IO.readlines(text_file.path).join.strip : ""
ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
@body = ic.iconv(@body)
if @body.blank? && html_file = default_html
html = Nokogiri::HTML(IO.read(html_file.path))
@body = (html.xpath("//head/title").map(&:text) + html.xpath("//body/*").map(&:text)).join(" ")
Expand Down

0 comments on commit 8f61457

Please sign in to comment.