зеркало из https://github.com/mozilla/gecko-dev.git
Bug 615595. Set the form submission's mCharset to the charset we're actually using to encode the data. r=sicking
This commit is contained in:
Родитель
1d8182bb87
Коммит
93deda78c2
|
@ -718,15 +718,8 @@ nsEncodingFormSubmission::nsEncodingFormSubmission(const nsACString& aCharset,
|
|||
charset.AssignLiteral("windows-1252");
|
||||
}
|
||||
|
||||
// use UTF-8 for UTF-16* (per WHATWG and existing practice of
|
||||
// MS IE/Opera).
|
||||
if (StringBeginsWith(charset, NS_LITERAL_CSTRING("UTF-16"))) {
|
||||
charset.AssignLiteral("UTF-8");
|
||||
}
|
||||
|
||||
if (!(charset.EqualsLiteral("UTF-8") || charset.EqualsLiteral("gb18030"))) {
|
||||
nsAutoString charsetUtf16;
|
||||
CopyUTF8toUTF16(charset, charsetUtf16);
|
||||
NS_ConvertUTF8toUTF16 charsetUtf16(charset);
|
||||
const PRUnichar* charsetPtr = charsetUtf16.get();
|
||||
SendJSWarning(aOriginatingElement ? aOriginatingElement->GetOwnerDocument()
|
||||
: nsnull,
|
||||
|
@ -869,6 +862,15 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
|
|||
nsCAutoString charset;
|
||||
GetSubmitCharset(aForm, charset);
|
||||
|
||||
// We now have a canonical charset name, so we only have to check it
|
||||
// against canonical names.
|
||||
|
||||
// use UTF-8 for UTF-16* (per WHATWG and existing practice of
|
||||
// MS IE/Opera).
|
||||
if (StringBeginsWith(charset, NS_LITERAL_CSTRING("UTF-16"))) {
|
||||
charset.AssignLiteral("UTF-8");
|
||||
}
|
||||
|
||||
// Choose encoder
|
||||
if (method == NS_FORM_METHOD_POST &&
|
||||
enctype == NS_FORM_ENCTYPE_MULTIPART) {
|
||||
|
|
|
@ -272,6 +272,7 @@ _TEST_FILES = \
|
|||
test_bug674558.html \
|
||||
test_bug583533.html \
|
||||
test_restore_from_parser_fragment.html \
|
||||
test_bug615595.html \
|
||||
test_bug617528.html \
|
||||
test_bug660959-1.html \
|
||||
test_bug660959-2.html \
|
||||
|
|
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче