Author: manolo
Date: Tue Jul 17 06:27:39 2012
New Revision: 1362375
URL: http://svn.apache.org/viewvc?rev=1362375&view=rev
Log:
FIXES HUPA-94, patch by: Zsombor Gegesy
Modified:
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
Modified:
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java?rev=1362375&r1=1362374&r2=1362375&view=diff
==============================================================================
---
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
(original)
+++
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
Tue Jul 17 06:27:39 2012
@@ -321,11 +321,11 @@ public abstract class AbstractSendMessag
}
if (text != null) {
txtPart = new MimeBodyPart();
- txtPart.setContent(text, "text/plain");
+ txtPart.setContent(text, "text/plain; charset=UTF-8");
}
if (html != null) {
htmlPart = new MimeBodyPart();
- htmlPart.setContent(html, "text/html");
+ htmlPart.setContent(html, "text/html; charset=UTF-8");
}
if (html != null && text != null) {
mimeMultipart = new MimeMultipart();
Modified:
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java?rev=1362375&r1=1362374&r2=1362375&view=diff
==============================================================================
---
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
(original)
+++
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
Tue Jul 17 06:27:39 2012
@@ -20,8 +20,16 @@
package org.apache.hupa.server.handler;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import javax.mail.BodyPart;
import javax.mail.Message;
+import javax.mail.MessagingException;
import javax.mail.Part;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
import org.apache.hupa.server.HupaGuiceTestCase;
import org.apache.hupa.server.mock.MockIMAPFolder;
@@ -81,6 +89,24 @@ public class AbtractSendMessageHandlerTe
assertEquals(exp, TestUtils.summaryzeContent(msg).toString());
}
+ public void testEncoding() throws MessagingException, IOException {
+ String txt = "XXXX \u00e1rv\u00edzt\u0171r\u0151
t\u00fck\u00f6rf\u00far\u00f3 \u00c1RV\u00cdZT\u0170R\u0150
T\u00dcK\u00d6RF\u00daR\u00d3";
+ String html = "<body>\u00e1rv\u00edzt\u0171r\u0151
t\u00fck\u00f6rf\u00far\u00f3 \u00c1RV\u00cdZT\u0170R\u0150
T\u00dcK\u00d6RF\u00daR\u00d3</body>";
+ Message msg = TestUtils.createMockMimeMessage(session, txt, html, 0);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ msg.writeTo(baos);
+
+ MimeMessage input = new MimeMessage(null, new
ByteArrayInputStream(baos.toByteArray()));
+ MimeMultipart content = (MimeMultipart) input.getContent();
+ BodyPart bodyPart0 = content.getBodyPart(0);
+ Object content0 = bodyPart0.getContent();
+ BodyPart bodyPart1 = content.getBodyPart(1);
+ Object content1 = bodyPart1.getContent();
+
+ assertEquals(txt, content0);
+ assertEquals(html, content1);
+ }
+
public void testRestoreInlineLinks() {
String txt, res;
txt = ".. <img\nsrc='...&name=abcd' name='cid:abcd'\nwhatever=/> ..";
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]