Ruby encoding issue showing weird characters on emails -



Ruby encoding issue showing weird characters on emails -

im on ruby 1.9.3p545 , rails 3.0.20

i have contact form , i'm sending next email user when fill up:

give thanks enquiry beverly, email receipt confirm have received enquiry , `we'll` in touch shortly.

my issue it's showing we'll instead of showing we'll , need display message properly?

my controller create action:

def create @inquiry = inquiry.new(params[:inquiry]) if @inquiry.save if @inquiry.ham? begin inquirymailer.notification(@inquiry, request).deliver rescue logger.warn "there error delivering enquiry notification.\n#{$!}\n" end begin inquirymailer.confirmation(@inquiry, request).deliver rescue logger.warn "there error delivering enquiry confirmation:\n#{$!}\n" end end redirect_to thank_you_inquiries_url else render :action => 'new' end end

i'm using on refinery-cms

on app/views/inquiry_mailer/confirmation.html.erb

i have: <%= inquirysetting.confirmation_message(globalize.locale).gsub("%name%", @inquiry.name) %>

and on refinery settings have next email:

thank enquiry %name%, email receipt confirm have received enquiry , we'll in touch shortly.

any help appreciated!

rails sanitises string of inquirysetting.confirmation_message(globalize.locale).gsub("%name%", @inquiry.name). in order prevent html tags , within perchance user provided strings rendered server. otherwise application open xss attacks.

if know string confirmation_message not user changeable contents can deactivate rails' security mechanism declaring string safe. changing contents of template <%= raw inquirysetting.confirmation_message(globalize.locale).gsub("%name%", @inquiry.name) %>.

again, please if trust source of template's contents.

ruby-on-rails ruby

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -