Bug 448842 - solution for bug 410333 introducing regression for Japanese users; r=mnyromyr sr=bienvenu
This commit is contained in:
Родитель
a97393662f
Коммит
4c5a6d6ac9
|
@ -90,7 +90,6 @@ var gMsgAttachmentElement;
|
|||
var gMsgHeadersToolbarElement;
|
||||
|
||||
// i18n globals
|
||||
var gCurrentMailSendCharset;
|
||||
var gSendDefaultCharset;
|
||||
var gCharsetTitle;
|
||||
var gCharsetConvertManager;
|
||||
|
@ -129,7 +128,6 @@ function InitializeGlobalVariables()
|
|||
gLDAPSession = null;
|
||||
gSavedSendNowKey = null;
|
||||
gSendFormat = nsIMsgCompSendFormat.AskUser;
|
||||
gCurrentMailSendCharset = null;
|
||||
gSendDefaultCharset = null;
|
||||
gCharsetTitle = null;
|
||||
gCharsetConvertManager = Components.classes['@mozilla.org/charset-converter-manager;1'].getService(Components.interfaces.nsICharsetConverterManager);
|
||||
|
@ -1520,7 +1518,6 @@ function SetDocumentCharacterSet(aCharset)
|
|||
|
||||
if (gMsgCompose) {
|
||||
gMsgCompose.SetDocumentCharset(aCharset);
|
||||
gCurrentMailSendCharset = aCharset;
|
||||
gCharsetTitle = null;
|
||||
SetComposeWindowTitle();
|
||||
}
|
||||
|
@ -1556,12 +1553,6 @@ function UpdateMailEditCharset()
|
|||
|
||||
function InitCharsetMenuCheckMark()
|
||||
{
|
||||
// return if the charset is already set explitily
|
||||
if (gCurrentMailSendCharset != null) {
|
||||
dump("already set to " + gCurrentMailSendCharset + "\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the menu
|
||||
UpdateMailEditCharset();
|
||||
// use setTimeout workaround to delay checkmark the menu
|
||||
|
@ -1771,6 +1762,7 @@ function GenericSendMessage( msgType )
|
|||
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
|
||||
observerService.notifyObservers(window, "mail:composeOnSend", null);
|
||||
|
||||
var originalCharset = gMsgCompose.compFields.characterSet;
|
||||
// Check if the headers of composing mail can be converted to a mail charset.
|
||||
if (msgType == nsIMsgCompDeliverMode.Now ||
|
||||
msgType == nsIMsgCompDeliverMode.Later ||
|
||||
|
@ -1780,9 +1772,21 @@ function GenericSendMessage( msgType )
|
|||
msgType == nsIMsgCompDeliverMode.SaveAsTemplate)
|
||||
{
|
||||
var fallbackCharset = new Object;
|
||||
// Check encoding, switch to UTF-8 if the default encoding doesn't fit.
|
||||
// Check encoding, switch to UTF-8 if the default encoding doesn't fit
|
||||
// and disable_fallback_to_utf8 isn't set for this encoding.
|
||||
if (!gMsgCompose.checkCharsetConversion(getCurrentIdentity(), fallbackCharset))
|
||||
fallbackCharset.value = "UTF-8";
|
||||
{
|
||||
var disableFallback = false;
|
||||
try
|
||||
{
|
||||
disableFallback = getPref("mailnews.disable_fallback_to_utf8." + originalCharset);
|
||||
}
|
||||
catch (e) {}
|
||||
if (disableFallback)
|
||||
msgCompFields.needToCheckCharset = false;
|
||||
else
|
||||
fallbackCharset.value = "UTF-8";
|
||||
}
|
||||
|
||||
if (fallbackCharset &&
|
||||
fallbackCharset.value && fallbackCharset.value != "")
|
||||
|
@ -1830,6 +1834,8 @@ function GenericSendMessage( msgType )
|
|||
enableEditableFields();
|
||||
updateComposeItems();
|
||||
}
|
||||
if (gMsgCompose && originalCharset != gMsgCompose.compFields.characterSet)
|
||||
SetDocumentCharacterSet(gMsgCompose.compFields.characterSet);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -110,7 +110,6 @@ var gMsgAttachmentElement;
|
|||
var gMsgHeadersToolbarElement;
|
||||
|
||||
// i18n globals
|
||||
var gCurrentMailSendCharset;
|
||||
var gSendDefaultCharset;
|
||||
var gCharsetTitle;
|
||||
var gCharsetConvertManager;
|
||||
|
@ -148,7 +147,6 @@ function InitializeGlobalVariables()
|
|||
gLDAPSession = null;
|
||||
gSavedSendNowKey = null;
|
||||
gSendFormat = nsIMsgCompSendFormat.AskUser;
|
||||
gCurrentMailSendCharset = null;
|
||||
gSendDefaultCharset = null;
|
||||
gCharsetTitle = null;
|
||||
gCharsetConvertManager = Components.classes['@mozilla.org/charset-converter-manager;1'].getService(Components.interfaces.nsICharsetConverterManager);
|
||||
|
@ -1542,7 +1540,6 @@ function SetDocumentCharacterSet(aCharset)
|
|||
|
||||
if (gMsgCompose) {
|
||||
gMsgCompose.SetDocumentCharset(aCharset);
|
||||
gCurrentMailSendCharset = aCharset;
|
||||
gCharsetTitle = null;
|
||||
SetComposeWindowTitle();
|
||||
}
|
||||
|
@ -1578,12 +1575,6 @@ function UpdateMailEditCharset()
|
|||
|
||||
function InitCharsetMenuCheckMark()
|
||||
{
|
||||
// return if the charset is already set explitily
|
||||
if (gCurrentMailSendCharset != null) {
|
||||
dump("already set to " + gCurrentMailSendCharset + "\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the menu
|
||||
UpdateMailEditCharset();
|
||||
// use setTimeout workaround to delay checkmark the menu
|
||||
|
@ -1794,6 +1785,7 @@ function GenericSendMessage( msgType )
|
|||
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
|
||||
observerService.notifyObservers(window, "mail:composeOnSend", null);
|
||||
|
||||
var originalCharset = gMsgCompose.compFields.characterSet;
|
||||
// Check if the headers of composing mail can be converted to a mail charset.
|
||||
if (msgType == nsIMsgCompDeliverMode.Now ||
|
||||
msgType == nsIMsgCompDeliverMode.Later ||
|
||||
|
@ -1803,9 +1795,21 @@ function GenericSendMessage( msgType )
|
|||
msgType == nsIMsgCompDeliverMode.SaveAsTemplate)
|
||||
{
|
||||
var fallbackCharset = new Object;
|
||||
// Check encoding, switch to UTF-8 if the default encoding doesn't fit.
|
||||
// Check encoding, switch to UTF-8 if the default encoding doesn't fit
|
||||
// and disable_fallback_to_utf8 isn't set for this encoding.
|
||||
if (!gMsgCompose.checkCharsetConversion(getCurrentIdentity(), fallbackCharset))
|
||||
fallbackCharset.value = "UTF-8";
|
||||
{
|
||||
var disableFallback = false;
|
||||
try
|
||||
{
|
||||
disableFallback = sPrefs.getBoolPref("mailnews.disable_fallback_to_utf8." + originalCharset);
|
||||
}
|
||||
catch (e) {}
|
||||
if (disableFallback)
|
||||
msgCompFields.needToCheckCharset = false;
|
||||
else
|
||||
fallbackCharset.value = "UTF-8";
|
||||
}
|
||||
|
||||
if (fallbackCharset &&
|
||||
fallbackCharset.value && fallbackCharset.value != "")
|
||||
|
@ -1853,6 +1857,8 @@ function GenericSendMessage( msgType )
|
|||
enableEditableFields();
|
||||
updateComposeItems();
|
||||
}
|
||||
if (gMsgCompose && originalCharset != gMsgCompose.compFields.characterSet)
|
||||
SetDocumentCharacterSet(gMsgCompose.compFields.characterSet);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1098,18 +1098,34 @@ NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity
|
|||
if (NS_SUCCEEDED(rv) && !outCString.IsEmpty())
|
||||
{
|
||||
// If the body contains characters outside the repertoire of the current
|
||||
// charset, just convert to UTF-8 and be done with it.
|
||||
if (NS_ERROR_UENC_NOMAPPING == rv && m_editor) {
|
||||
// charset, just convert to UTF-8 and be done with it
|
||||
// unless disable_fallback_to_utf8 is set for this charset.
|
||||
if (NS_ERROR_UENC_NOMAPPING == rv && m_editor)
|
||||
{
|
||||
PRBool needToCheckCharset;
|
||||
m_compFields->GetNeedToCheckCharset(&needToCheckCharset);
|
||||
if (needToCheckCharset) {
|
||||
CopyUTF16toUTF8(msgBody.get(), outCString);
|
||||
m_compFields->SetCharacterSet("UTF-8");
|
||||
if (needToCheckCharset)
|
||||
{
|
||||
PRBool disableFallback = PR_FALSE;
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||
if (prefBranch)
|
||||
{
|
||||
nsCString prefName("mailnews.disable_fallback_to_utf8.");
|
||||
prefName.Append(m_compFields->GetCharacterSet());
|
||||
prefBranch->GetBoolPref(prefName.get(), &disableFallback);
|
||||
}
|
||||
if (!disableFallback)
|
||||
{
|
||||
CopyUTF16toUTF8(msgBody.get(), outCString);
|
||||
m_compFields->SetCharacterSet("UTF-8");
|
||||
}
|
||||
}
|
||||
}
|
||||
// re-label to the fallback charset
|
||||
else if (!fallbackCharset.IsEmpty())
|
||||
{
|
||||
// re-label to the fallback charset
|
||||
m_compFields->SetCharacterSet(fallbackCharset.get());
|
||||
}
|
||||
m_compFields->SetBodyIsAsciiOnly(isAsciiOnly);
|
||||
m_compFields->SetBody(outCString.get());
|
||||
entityConversionDone = PR_TRUE;
|
||||
|
|
|
@ -1793,18 +1793,34 @@ nsMsgComposeAndSend::GetBodyFromEditor()
|
|||
rv = nsMsgI18NSaveAsCharset(TEXT_PLAIN, aCharset, bodyText,
|
||||
getter_Copies(outCString), getter_Copies(fallbackCharset));
|
||||
|
||||
if (NS_ERROR_UENC_NOMAPPING == rv) {
|
||||
if (NS_ERROR_UENC_NOMAPPING == rv)
|
||||
{
|
||||
PRBool needToCheckCharset;
|
||||
mCompFields->GetNeedToCheckCharset(&needToCheckCharset);
|
||||
if (needToCheckCharset) {
|
||||
// Just use UTF-8 and be done with it.
|
||||
CopyUTF16toUTF8(bodyText, outCString);
|
||||
mCompFields->SetCharacterSet("UTF-8");
|
||||
if (needToCheckCharset)
|
||||
{
|
||||
// Just use UTF-8 and be done with it
|
||||
// unless disable_fallback_to_utf8 is set for this charset.
|
||||
PRBool disableFallback = PR_FALSE;
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||
if (prefBranch)
|
||||
{
|
||||
nsCString prefName("mailnews.disable_fallback_to_utf8.");
|
||||
prefName.Append(aCharset);
|
||||
prefBranch->GetBoolPref(prefName.get(), &disableFallback);
|
||||
}
|
||||
if (!disableFallback)
|
||||
{
|
||||
CopyUTF16toUTF8(bodyText, outCString);
|
||||
mCompFields->SetCharacterSet("UTF-8");
|
||||
}
|
||||
}
|
||||
}
|
||||
// re-label to the fallback charset
|
||||
else if (!fallbackCharset.IsEmpty())
|
||||
{
|
||||
// re-label to the fallback charset
|
||||
mCompFields->SetCharacterSet(fallbackCharset.get());
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
|
|
@ -302,6 +302,10 @@ pref("mailnews.send_default_charset", "chrome://messenger/locale/messenger
|
|||
pref("mailnews.view_default_charset", "chrome://messenger/locale/messenger.properties");
|
||||
pref("mailnews.force_charset_override", false); // ignore specified MIME encoding and use the default encoding for display
|
||||
pref("mailnews.reply_in_default_charset", false);
|
||||
// mailnews.disable_fallback_to_utf8.<charset>
|
||||
// don't fallback from <charset> to UTF-8 even if some characters are not found in <charset>.
|
||||
// those characters will be crippled.
|
||||
pref("mailnews.disable_fallback_to_utf8.ISO-2022-JP", false);
|
||||
pref("mailnews.localizedRe", "chrome://messenger-region/locale/region.properties");
|
||||
|
||||
pref("mailnews.search_date_format", "chrome://messenger/locale/messenger.properties");
|
||||
|
|
Загрузка…
Ссылка в новой задаче