зеркало из https://github.com/mozilla/pjs.git
fixes bug 261929 "Consider sending urls in UTF-8 by default (images/links with non-ASCII chacters not displayed)" r=jshin sr=bzbarsky
This commit is contained in:
Родитель
e262c3bb12
Коммит
19493b9eec
|
@ -568,7 +568,7 @@ pref("network.standard-url.escape-utf8", true);
|
|||
|
||||
// This preference controls whether or not URLs are always encoded and sent as
|
||||
// UTF-8.
|
||||
pref("network.standard-url.encode-utf8", false);
|
||||
pref("network.standard-url.encode-utf8", true);
|
||||
|
||||
// Idle timeout for ftp control connections - 5 minute default
|
||||
pref("network.ftp.idleConnectionTimeout", 300);
|
||||
|
@ -601,10 +601,10 @@ pref("network.negotiate-auth.allow-proxies", true);
|
|||
|
||||
// The following prefs are used to enable automatic use of the operating
|
||||
// system's NTLM implementation to silently authenticate the user with their
|
||||
// Window's domain logon. By default, this is enabled for proxy servers.
|
||||
// The trusted-uris pref follows the format of the trusted-uris pref for
|
||||
// negotiate authentication.
|
||||
pref("network.automatic-ntlm-auth.allow-proxies", true);
|
||||
// Window's domain logon. By default, this is disabled for proxy servers due
|
||||
// to bug 256949. The trusted-uris pref follows the format of the trusted-uris
|
||||
// pref for negotiate authentication.
|
||||
pref("network.automatic-ntlm-auth.allow-proxies", false);
|
||||
pref("network.automatic-ntlm-auth.trusted-uris", "");
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ nsIIDNService *nsStandardURL::gIDNService = nsnull;
|
|||
nsICharsetConverterManager *nsStandardURL::gCharsetMgr = nsnull;
|
||||
PRBool nsStandardURL::gInitialized = PR_FALSE;
|
||||
PRBool nsStandardURL::gEscapeUTF8 = PR_TRUE;
|
||||
PRBool nsStandardURL::gAlwaysEncodeInUTF8 = PR_FALSE;
|
||||
PRBool nsStandardURL::gAlwaysEncodeInUTF8 = PR_TRUE;
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
|
@ -180,7 +180,7 @@ nsSegmentEncoder::EncodeSegmentCount(const char *str,
|
|||
// null or the empty string then the origin charset is UTF-8 and there
|
||||
// is nothing to do.
|
||||
nsCAutoString encBuf;
|
||||
if (!nsCRT::IsAscii(str + pos, len) && mCharset && *mCharset) {
|
||||
if (mCharset && *mCharset && !nsCRT::IsAscii(str + pos, len)) {
|
||||
// we have to encode this segment
|
||||
if (mEncoder || InitUnicodeEncoder()) {
|
||||
NS_ConvertUTF8toUCS2 ucsBuf(Substring(str + pos, str + pos + len));
|
||||
|
@ -249,7 +249,7 @@ nsSegmentEncoder::InitUnicodeEncoder()
|
|||
}
|
||||
|
||||
#define GET_SEGMENT_ENCODER(name) \
|
||||
nsSegmentEncoder name(mOriginCharset.get())
|
||||
nsSegmentEncoder name(gAlwaysEncodeInUTF8 ? nsnull : mOriginCharset.get())
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// nsStandardURL <public>
|
||||
|
@ -2413,26 +2413,24 @@ nsStandardURL::Init(PRUint32 urlType,
|
|||
|
||||
mOriginCharset.Truncate();
|
||||
|
||||
if (!gAlwaysEncodeInUTF8) {
|
||||
if (charset == nsnull || *charset == '\0') {
|
||||
// check if baseURI provides an origin charset and use that.
|
||||
if (baseURI)
|
||||
baseURI->GetOriginCharset(mOriginCharset);
|
||||
if (charset == nsnull || *charset == '\0') {
|
||||
// check if baseURI provides an origin charset and use that.
|
||||
if (baseURI)
|
||||
baseURI->GetOriginCharset(mOriginCharset);
|
||||
|
||||
// URI can't be encoded in UTF-16, UTF-16BE, UTF-16LE, UTF-32,
|
||||
// UTF-32-LE, UTF-32LE, UTF-32BE (yet?). Truncate mOriginCharset if
|
||||
// it starts with "utf" (since an empty mOriginCharset implies
|
||||
// UTF-8, this is safe even if mOriginCharset is UTF-8).
|
||||
// URI can't be encoded in UTF-16, UTF-16BE, UTF-16LE, UTF-32,
|
||||
// UTF-32-LE, UTF-32LE, UTF-32BE (yet?). Truncate mOriginCharset if
|
||||
// it starts with "utf" (since an empty mOriginCharset implies
|
||||
// UTF-8, this is safe even if mOriginCharset is UTF-8).
|
||||
|
||||
if (mOriginCharset.Length() > 3 &&
|
||||
IsUTFCharset(mOriginCharset.get())) {
|
||||
mOriginCharset.Truncate();
|
||||
}
|
||||
}
|
||||
else if (!IsUTFCharset(charset)) {
|
||||
mOriginCharset = charset;
|
||||
if (mOriginCharset.Length() > 3 &&
|
||||
IsUTFCharset(mOriginCharset.get())) {
|
||||
mOriginCharset.Truncate();
|
||||
}
|
||||
}
|
||||
else if (!IsUTFCharset(charset)) {
|
||||
mOriginCharset = charset;
|
||||
}
|
||||
|
||||
if (baseURI) {
|
||||
PRUint32 start, end;
|
||||
|
|
Загрузка…
Ссылка в новой задаче