-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
There is an issue where an Encoding::CompatibilityError is raised when the request body is multipart and the Content-Type is a text format (e.g., text/html or text/plain) with the charset set to ISO-2022-JP. ISO-2022-JP is currently treated as a dummy encoding in Ruby, meaning it cannot be interpreted or processed by Ruby.
Other dummy encodings include UTF-7 and IBM037, which are rarely used today. However, ISO-2022-JP, though considered a legacy encoding, is still used in emails in Japan due to historical reasons. As a result, some services that relay emails over HTTP may still use ISO-2022-JP.
For example, SendGrid, a service that receives emails via an SMTP Gateway, represents these emails as multipart data and sends them to webhooks via HTTP POST. In this process, the email body, encoded in ISO-2022-JP, is sent as a part of the request in its original encoding.
In our environment, we use Rack to handle requests from SendGrid, but we are encountering an issue where these requests cannot be processed due to the ISO-2022-JP encoding.