Method: Mail::Encodings.param_encode
- Defined in:
- lib/mail/encodings.rb
.param_encode(str) ⇒ Object
Encodes a parameter value using URI Escaping, note the language field ‘en’ can be set using Mail::Configuration, like so:
Mail.defaults do
param_encode_language 'jp'
end
The character set used for encoding will be the encoding on the string passed in.
Example:
Mail::Encodings.param_encode("This is fun") #=> "us-ascii'en'This%20is%20fun"
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/mail/encodings.rb', line 73 def Encodings.param_encode(str) case when str.ascii_only? && str =~ TOKEN_UNSAFE %Q{"#{str}"} when str.ascii_only? str else Utilities.param_encode(str) end end |