Merge pull request #44 from murashin/master

avoid invalid byte sequence error
Merge pull request #45 from murashin/master

add support for data generated by misc/plugin/attach.rb
Remove trailing white spaces
Extract convert_attachments

But I don't test this commit, yet.
I don't have enough environment for test.
Use meaningful names
Use extracted local variable
Merge remote-tracking branch 'upstream/master'