Skip to content

Instantly share code, notes, and snippets.

@abelorian
Created October 6, 2016 01:27
Show Gist options
  • Save abelorian/36a5f1a47eeccd505219d517763f548f to your computer and use it in GitHub Desktop.
Save abelorian/36a5f1a47eeccd505219d517763f548f to your computer and use it in GitHub Desktop.
Paypal PIN and Rails: ActiveRecord::StatementInvalid: PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding "UTF8": 0xf3 0x6e
def paypal_method
transaction_subject = clean_param params[:transaction_subject]
end
def clean_param value
return '' if value.nil?
value.to_s.encode('UTF-8', :invalid => :replace, :undef => :replace)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment