encode does no work if it thinks it's already utf-8 (even if invalid)

Also use duck typing for whether we should use encode
Add test for _get_attachment_text_internal with invalid utf-8
Merge remote-tracking branch 'opennewzealand_github/feature/encode-utf8-messages' into rails-3-develop