我从Cloudmailin收集Rails电子邮件时收到以下PGError:
@H_301_11@解决方法
PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xbb HINT: This error can also happen if the byte sequence does not match the encoding expected by the server,which is controlled by "client_encoding". : INSERT INTO "comments" ("content") VALUES ('Reply with blah blah ����������������������������������������������������� .....
所以很明显我有一些无效的UTF8字符进入电子邮件吧?所以我试着清理它,但仍有一些东西在偷偷摸摸.这是我到目前为止所拥有的:
message_all_clean = params[:message] Iconv.conv('UTF-8//IGNORE','UTF-8',message_all_clean) message_plain_clean = params[:plain] Iconv.conv('UTF-8//IGNORE',message_plain_clean) @incoming_mail = IncomingMail.create(:message_all => Base64.encode64(message_all_clean),:message_plain => Base64.encode64(message_plain_clean))
任何想法,想法或建议?谢谢