Commit 93deda78 authored by Boris Zbarsky's avatar Boris Zbarsky
Browse files

Bug 615595. Set the form submission's mCharset to the charset we're actually...

Bug 615595.  Set the form submission's mCharset to the charset we're actually using to encode the data.  r=sicking
parent 1d8182bb
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -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) {
+1 −0
Original line number Diff line number Diff line
@@ -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 \
+0 −0

File added.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.