-
Couldn't load subscription status.
- Fork 38.8k
Closed as not planned
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
I have this example code:
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import jakarta.mail.internet.MimeMessage;
public class SendMail {
public static void main(String[] args) throws Exception {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true); // no charset specified!
helper.setText("test: €", false);
message.saveChanges();
message.writeTo(System.out);
}
}And with plaintext multipart it works OK:
Date: Fri, 18 Apr 2025 15:07:45 +0200 (CEST)
Message-ID: <32863545.2.1744981670669@cyberone>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_0_1447689627.1744981665679"
------=_Part_0_1447689627.1744981665679
Content-Type: multipart/related;
boundary="----=_Part_1_1589683045.1744981665683"
------=_Part_1_1589683045.1744981665683
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
test: =E2=82=AC
------=_Part_1_1589683045.1744981665683--
------=_Part_0_1447689627.1744981665679--
The euro symbol is encoded in UTF-8 as =E2=82=AC, which is correct.
If I change this line to HTML though:
helper.setText("test: €", true);the multipart is different:
------=_Part_1_1589683045.1744982134344
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
test: ?
------=_Part_1_1589683045.1744982134344--
This is with local output. When sending to a SMTP server, I one got the header declaring UTF-8 and then the content using a single high-bit value, which was actually encoded in Latin9.
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid