public Method

Mail.charset( default = nil )

Returns the character set of the email. Returns nil if no encoding set or returns whatever default you pass as a parameter - note passing the parameter does NOT change the mail object in any way.

Example:

mail = TMail::Mail.load("path_to/utf8_email")
mail.charset #=> "UTF-8"

mail = TMail::Mail.new
mail.charset #=> nil
mail.charset("US-ASCII") #=> "US-ASCII"

Source Code

# File action_mailer/vendor/tmail-1.2.2/tmail/interface.rb, line 837
def charset( default = nil )
  if h = @header['content-type']
    h['charset'] or default
  else
    default
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.