james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nik...@apache.org
Subject svn commit: r678382 - /james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java
Date Mon, 21 Jul 2008 10:15:42 GMT
Author: niklas
Date: Mon Jul 21 03:15:41 2008
New Revision: 678382

URL: http://svn.apache.org/viewvc?rev=678382&view=rev
Log:
Saved txt files will now use the mime charset specified for the body part instead of the Java
default.

Modified:
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java

Modified: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java?rev=678382&r1=678381&r2=678382&view=diff
==============================================================================
--- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java
(original)
+++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java
Mon Jul 21 03:15:41 2008
@@ -227,8 +227,13 @@
     private void writeToFile(Body b, File mime4jFile)
             throws FileNotFoundException, IOException {
         if (b instanceof TextBody) {
+            String charset = CharsetUtil.toJavaCharset(b.getParent().getCharset());
+            if (charset == null) {
+                charset = "ISO8859-1";
+            }
+
             OutputStream out = new FileOutputStream(mime4jFile);
-            IOUtils.copy(((TextBody) b).getReader(), out);
+            IOUtils.copy(((TextBody) b).getReader(), out, charset);
         } else {
             OutputStream out = new FileOutputStream(mime4jFile);
             IOUtils.copy(((BinaryBody) b).getInputStream(), out);



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message