From ebab5342942eceb498319c31a07fc58db78585e1 Mon Sep 17 00:00:00 2001 From: graf25 Date: Fri, 9 Feb 2001 07:18:42 +0000 Subject: [PATCH] Bugfixes in l10n git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1081 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/i18n.php | 24 +++++++++++++++++++++++- functions/page_header.php | 8 ++++++-- src/compose.php | 5 ++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/functions/i18n.php b/functions/i18n.php index 6be9f3ed..8c0728ec 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -762,7 +762,9 @@ 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); } @@ -777,6 +779,26 @@ 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; + } + ?> diff --git a/functions/page_header.php b/functions/page_header.php index 0a9e40ba..9e95b3b3 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -19,10 +19,14 @@ 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") { diff --git a/src/compose.php b/src/compose.php index 3b4782dd..9e60b092 100644 --- a/src/compose.php +++ b/src/compose.php @@ -426,7 +426,10 @@ $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); -- 2.25.1