Misc MIME Functions

## Functions

string | Mime::get_mime_type_from_ext (string path)
| returns the mime type for the given filename from the extension or Mime::MimeTypeUnknown if the extension is not present or unknown
string | Mime::mime_decode_urlencoded_string (string str)
| decodes the given string from URL encoded format More...
string | Mime::mime_get_form_urlencoded_string (hash h)
| returns a string in MIME multipart form URL encoded format (for use with `"Content-Type: application/x-www-form-urlencoded"` data) More...
string | Mime::mime_get_urlencoded_string (auto val)
| returns a single string in MIME URL encoded format More...
hash | Mime::mime_parse_form_urlencoded_string (string str)
| returns a hash corresponding to the string in MIME multipart form URL encoded format (for use with `"Content-Type: application/x-www-form-urlencoded"` data) More...

## Detailed Description

## Function Documentation

## mime_decode_urlencoded_string()

string Mime::mime_decode_urlencoded_string | ( | string | str | ) |

decodes the given string from URL encoded format

Parameters

  str | the URL encoded string to decode

Returns
  the decoded string

See also
  RFC 2738 2.2

Since
  Mime 1.3.4.1

## mime_get_form_urlencoded_string()

string Mime::mime_get_form_urlencoded_string | ( | hash | h | ) |

returns a string in MIME multipart form URL encoded format (for use with `"Content-Type: application/x-www-form-urlencoded"` data)

Parameters will be separated by `"&"` characters. All key values must be strings or convertible to strings or a URLENCODED-TYPE-ERROR exception is thrown

Parameters

  h | the hash to use to generate the string

Returns
  a string in `application/x-www-form-urlencoded` format

Exceptions

  URLENCODED-TYPE-ERROR | hash value cannot be converted to a string
  INVALID-CHARACTER | an invalid character has been found

See also
  RFC 2738 2.2

Since
  Mime 1.3.4.1

## mime_get_urlencoded_string()

string Mime::mime_get_urlencoded_string | ( | auto | val | ) |

returns a single string in MIME URL encoded format

reserved characters are replaced with percent encoding, characters outside the ASCII character set cause an exception to be thrown

Parameters

  val | the input value

Returns
  the output string in MIME URL encoded format

Exceptions

  INVALID-VALUE | the value given cannot be converted to a string
  INVALID-CHARACTER | an invalid character has been found

See also
  RFC 2738 2.2

Note
  spaces are not replaced with `'+'` signs but rather encoded as `%20` because `'+'` signs are often encoded and decoded improperly in URLs, and `%20` is unambiguous

Since
  Mime 1.3.4.1

## mime_parse_form_urlencoded_string()

hash Mime::mime_parse_form_urlencoded_string | ( | string | str | ) |

returns a hash corresponding to the string in MIME multipart form URL encoded format (for use with `"Content-Type: application/x-www-form-urlencoded"` data)

Parameters

  str | the string to parse

Returns
  the hash corresponding to the string

Exceptions

  URLENCODED-PARSE-ERROR | cannot parse the given string

See also
  RFC 2738 2.2

Since
  Mime 1.3.4.1