From dafb50aa49e13edebdd0c47af861facf4bef12e1 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 08 Feb 2013 02:57:13 -0500
Subject: [PATCH] Fix filenames charset handling (#1488946)

---
 plugins/zipdownload/zipdownload.php |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php
index 96c76ee..7e132bf 100644
--- a/plugins/zipdownload/zipdownload.php
+++ b/plugins/zipdownload/zipdownload.php
@@ -30,9 +30,9 @@
 		}
 
 		$rcmail = rcmail::get_instance();
-		$this->charset = $rcmail->config->get('zipdownload_charset', RCUBE_CHARSET);
 
 		$this->load_config();
+		$this->charset = $rcmail->config->get('zipdownload_charset', RCUBE_CHARSET);
 		$this->add_texts('localization');
 
 		if ($rcmail->config->get('zipdownload_attachments', 1) > -1 && ($rcmail->action == 'show' || $rcmail->action == 'preview'))
@@ -211,7 +211,7 @@
 				$disp_name = "message_rfc822.eml";
 
 			$disp_name = $uid . "_" . $disp_name;
-			
+
 			$tmpfn = tempnam($temp_dir, 'zipmessage');
 			$tmpfp = fopen($tmpfn, 'w');
 			$imap->get_raw_body($uid, $tmpfp);
@@ -265,8 +265,8 @@
 	 */
 	private function _convert_filename($str, $from = RCUBE_CHARSET)
 	{
-		return strtr(rcube_charset::convert($str, $from, $this->charset), array(':'=>'', '/'=>'-'));
+        $str = rcube_charset::convert($str, $from == '' ? RCUBE_CHARSET : $from, $this->charset);
+
+		return strtr($str, array(':'=>'', '/'=>'-'));
 	}
 }
-
-?>
\ No newline at end of file

--
Gitblit v1.9.1