Bugfixes in l10n
authorgraf25 <graf25@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 9 Feb 2001 07:18:42 +0000 (07:18 +0000)
committergraf25 <graf25@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 9 Feb 2001 07:18:42 +0000 (07:18 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1081 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/i18n.php
functions/page_header.php
src/compose.php

index 6be9f3eda31056b83e7b43e0768895a172b87bc1..8c0728ec7d3f7e08d73d4aae2e147bb5a01c7de0 100644 (file)
       if ($SetupAlready)
          return;
       $SetupAlready = 1;
-     
+      
+      $charset_headers_sent=false;
+      
       if ($do_search && ! $sm_language && isset($HTTP_ACCEPT_LANGUAGE)) {
          $sm_language = substr($HTTP_ACCEPT_LANGUAGE, 0, 2);
       }
          bindtextdomain('squirrelmail', '../locale/');
          textdomain('squirrelmail');
          header ('Content-Type: text/html; charset=' . $languages[$sm_language]['CHARSET']);
+         $charset_headers_sent=true;
       }
+      return $charset_headers_sent;
    }
+
+   function set_my_charset(){
+     //
+     // There can be a $default_charset setting in the
+     // config.php file, but the user may have a different language
+     // selected for a user interface. This function checks the
+     // language selected by the user and tags the outgoing messages 
+     // with the appropriate charset corresponding to the language
+     // selection. This is "more right" (tm), than just stamping the 
+     // message blindly with the system-wide $default_charset.
+     //
+     global $data_dir, $username, $default_charset, $languages;
+     $my_language = getPref($data_dir, $username, "language");
+     if (!$my_language) return;
+     $my_charset=$languages[$my_language]['CHARSET'];
+     if ($my_charset) $default_charset=$my_charset;
+   }
+
 ?>
index 0a9e40ba018b00bee0508c765f051dab70ac405a..9e95b3b364f6ac63f1ffff24e3f02e257a9e36df 100644 (file)
       include ("../functions/plugin.php");
 
    // Check to see if gettext is installed
-   set_up_language(getPref($data_dir, $username, "language"));
+   $headers_sent=set_up_language(getPref($data_dir, $username, "language"));
 
    // This is done to ensure that the character set is correct.
-   if ($default_charset != "")
+   // But first checks whether we have already sent headers
+   // with charset when we were setting up the user language.
+   // Otherwise user ends up with the default charset overriding
+   // his selected one.
+   if (!$headers_sent && $default_charset != "")
       header ("Content-Type: text/html; charset=$default_charset");
 
    function displayHtmlHeader ($title="SquirrelMail") {
index 3b4782dd9eeba5e383f3e8b98490d52f7406722f..9e60b0927c436d9c644d3b79d2daecc818dd8714 100644 (file)
          $urlMailbox = urlencode (trim($mailbox));
          if (! isset($reply_id))
              $reply_id = 0;
-         sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id);
+         // Set $default_charset to correspond with the user's selection
+        // of language interface.
+        set_my_charset();
+        sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id);
          header ("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1");
       } else {
          //$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);