You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ni...@apache.org on 2008/07/21 12:15:42 UTC

svn commit: r678382 - /james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java

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