开发者

Parsing an email content with german characters in rails

开发者 https://www.devze.com 2023-02-27 00:32 出处:网络
I am receiving incoming mails through sendgrid. When I receive an email with German language that contains umlaut characters in the params it is showing the full content, but when I read and save, it

I am receiving incoming mails through sendgrid. When I receive an email with German language that contains umlaut characters in the params it is showing the full content, but when I read and save, it is not saving after the umlaut character. I did a utf-8 conversion with

Iconv.conv('utf-8','ISO-8859-1' , str)

and, it is giving me the unicode string, but if I send the outgoing encoding as utf-8 in my gmail and send, it is working prope开发者_JAVA技巧rly. I can't rely on it as my customers may send without utf8 setting. Please let me know what should be done.


I achieved Iconv.new('utf-8', charset_encoding).iconv(params[:text])

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号