commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <lars.z.carls...@teliasonera.com>
Subject Problems with encoding UTF-8 for åäö
Date Wed, 23 Mar 2016 10:20:56 GMT
Hi
I have a problem that some mail clients show the wrong encoding for Swedish characters (åäö).
I try setting the message encoding to UTF-8 but it did't work i most have forgot something
in the code.
If you see any anything wrong in the code.



Java code:
----------------------------------
header.addHeaderField("Content-Type", "text/plain; charset=" + "UTF-8"); 
client = new SMTPClient("UTF-8");
client.connect(server);

client.login();

client.setSender(sender);
client.addRecipient(recipient);

for (String recpt : ccList) {
	client.addRecipient(recpt);
}

writer = client.sendMessageData();

if (writer != null) {
	writer.write(header.toString());
	writer.write(body);
	writer.close();
	client.completePendingCommand();
}

client.logout();
client.disconnect();


Raw message in Thunderbird using source view: 
----------------------------------------------------------------------------------------
Content-Type: text/plain; charset="UTF-8"

Subject: äåö
....
X-STA-Spam: subject:?????? ?????? spec:disguised to:2**0 header:To:1
X-BTI-AntiSpam: score:0,sta:7/030,dnsbl:off,sw:off,bsn:none,spf:off,bsctr:off,dk:off,pbmf:none,ipr:0/3,trusted:yes,ts:no,bs:no,ubl:off
Received-SPF: none
....
MIME-Version: 1.0


åäö

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message