URI::MailTo raises InvalidComponentError when given these special symbols, which RFC 6068, section 2 requires be percent-encoded.
URI::MailTo.build(to: "#!$%&'*+-/=?^_`{}|@example.org")
# unrecognised opaque part for mailtoURL: #!$%&'*+-/=?^_`{}|@example.org (URI::InvalidComponentError)
# expected: mailto:%23%21%24%25%26%27%2A%2B-%2F%3D%3F%5E_%60%7B%7D%7C@example.org
- For reference, see this PR which implemented this behaviour in Rails' ActionView (though Rails has its own URI generation logic, and doesn't use
URI::MailTo).
- This logic was last changed back in 2014 in 3fdc4b6
URI::MailToraisesInvalidComponentErrorwhen given these special symbols, which RFC 6068, section 2 requires be percent-encoded.URI::MailTo).