-
Alex Vandiver authored
In Encode 2.52 and below, `decode_utf8(...)` called on a string with the internal utf8" flag (i.e. containing characters, not bytes) was a no-op. Encode 2.53 changed this, for parity with `decode('utf8', ...)` The contents of the 'Subject' header when sending mail were usually bytes, as parsed by MIME-Tools. As such, before adding the subject tag, they were decoded into characters. However, in the case where no Subject was given by the template (for example, the "Transaction" template), RT generated a (wide-character) string for the Subject based on the ticket title, and inserted it into the MIME object. Later, before the subject tag was added decode_utf8() was called on this wide string -- and prior to Encode 2.53, this was a no-op. Ensure that the values placed in the MIME header are always bytes, and not wide characters. There are two changes to do this: first, ensure that the automatically-generated subject is encoded before being used; and second, that the string with the subject tag is re-encoded before the header is set to it.
d469cacc