From ecb9fb058da8d0f5a8e59402c1c1ced21122cbc5 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 22 Jun 2009 12:20:34 -0400
Subject: [PATCH] - use RCMAIL_CHARSET instead of hardcoded 'utf-8'

---
 program/steps/mail/spell_pspell.inc   |    2 +-
 program/steps/mail/search.inc         |    4 ++--
 program/include/rcube_imap.php        |    2 +-
 program/include/rcube_json_output.php |    2 +-
 program/steps/mail/rss.inc            |    2 +-
 program/steps/addressbook/export.inc  |    2 +-
 program/steps/mail/sendmail.inc       |    2 +-
 program/include/rcube_html_page.php   |    7 +++++--
 8 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/program/include/rcube_html_page.php b/program/include/rcube_html_page.php
index 446efa5..6a19703 100644
--- a/program/include/rcube_html_page.php
+++ b/program/include/rcube_html_page.php
@@ -29,7 +29,7 @@
     protected $scripts_path = '';
     protected $script_files = array();
     protected $scripts = array();
-    protected $charset = 'UTF-8';
+    protected $charset = RCMAIL_CHARSET;
 
     protected $script_tag_file = "<script type=\"text/javascript\" src=\"%s\"></script>\n";
     protected $script_tag  =  "<script type=\"text/javascript\">\n/* <![CDATA[ */\n%s\n/* ]]> */\n</script>";
@@ -253,7 +253,10 @@
         $output = preg_replace_callback('!(src|href)=(["\']?)([a-z0-9/_.-]+.(css|js))(["\'\s>])!i', array($this, 'add_filemtime'), $output);
         $output = str_replace('$__skin_path', $base_path, $output);
 
-        echo rcube_charset_convert($output, 'UTF-8', $this->charset);
+        if ($this->charset != RCMAIL_CHARSET)
+	    echo rcube_charset_convert($output, RCMAIL_CHARSET, $this->charset);
+	else
+	    echo $output;
     }
     
     /**
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 7905894..28156a1 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2690,7 +2690,7 @@
 
 
   /**
-   * Convert body charset to UTF-8 according to the ctype_parameters
+   * Convert body charset to RCMAIL_CHARSET according to the ctype_parameters
    *
    * @param string Part body to decode
    * @param string Charset to convert from
diff --git a/program/include/rcube_json_output.php b/program/include/rcube_json_output.php
index cedc6bf..7bfca0a 100644
--- a/program/include/rcube_json_output.php
+++ b/program/include/rcube_json_output.php
@@ -29,7 +29,7 @@
 class rcube_json_output
 {
     private $config;
-    private $charset = 'UTF-8';
+    private $charset = RCMAIL_CHARSET;
     private $env = array();
     private $texts = array();
     private $commands = array();
diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc
index d49fbe9..101006f 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -26,7 +26,7 @@
 
 // send downlaod headers
 send_nocacheing_headers();
-header('Content-Type: text/x-vcard; charset=UTF-8');
+header('Content-Type: text/x-vcard; charset='.RCMAIL_CHARSET);
 header('Content-Disposition: attachment; filename="rcube_contacts.vcf"');
 
 while ($result && ($row = $result->next())) {
diff --git a/program/steps/mail/rss.inc b/program/steps/mail/rss.inc
index 72317c6..667a348 100644
--- a/program/steps/mail/rss.inc
+++ b/program/steps/mail/rss.inc
@@ -49,7 +49,7 @@
 
 // Send global XML output
 header('Content-type: text/xml');
-echo '<?xml version="1.0" encoding="UTF-8"?>
+echo '<?xml version="1.0" encoding="'.RCMAIL_CHARSET.'"?>
 	<rss version="2.0"
 	 xmlns:dc="http://purl.org/dc/elements/1.1/"
 	 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 8d24460..d62b128 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -21,8 +21,8 @@
 $_SESSION['page'] = 1;
 
 // using encodeURI with javascript "should" give us
-// a correctly UTF-8 encoded query string
-$imap_charset = 'UTF-8';
+// a correctly encoded query string
+$imap_charset = RCMAIL_CHARSET;
 
 // get search string
 $str = get_input_value('_q', RCUBE_INPUT_GET);
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 72f072a..d550a42 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -311,7 +311,7 @@
   // generic footer for all messages
   if (!empty($CONFIG['generic_message_footer'])) {
     $footer = file_get_contents(realpath($CONFIG['generic_message_footer']));
-    $footer = rcube_charset_convert($footer, 'UTF-8', $message_charset);
+    $footer = rcube_charset_convert($footer, RCMAIL_CHARSET, $message_charset);
   }
 }
 
diff --git a/program/steps/mail/spell_pspell.inc b/program/steps/mail/spell_pspell.inc
index 0722b5f..8e574a6 100644
--- a/program/steps/mail/spell_pspell.inc
+++ b/program/steps/mail/spell_pspell.inc
@@ -49,7 +49,7 @@
 $plink = pspell_new(get_input_value('lang', RCUBE_INPUT_GET), null, null, RCMAIL_CHARSET, PSPELL_FAST);
 
 // send output
-$out = '<?xml version="1.0" encoding="UTF-8"?><spellresult charschecked="'.rc_strlen($text).'">';
+$out = '<?xml version="1.0" encoding="'.RCMAIL_CHARSET.'"?><spellresult charschecked="'.rc_strlen($text).'">';
 
 $diff = 0;
 foreach ($words as $w) {

--
Gitblit v1.9.1