Closed Bug 1736344 Opened 10 months ago Closed 8 months ago

Make mailnews not misuse the encoding reload code path

Categories

(MailNews Core :: Internationalization, task)

Tracking

(thunderbird_esr91 wontfix)

RESOLVED FIXED
97 Branch
Tracking Status
thunderbird_esr91 --- wontfix

People

(Reporter: hsivonen, Assigned: rachel)

References

Details

Attachments

(1 file)

Currently, nsMessenger::SetDisplayCharset calls nsIContentViewer::SetReloadEncodingAndSource.

Clearly, the mailnews isn't reloading anything here and is injecting an encoding using API surface that is intended for managing encoding detector-triggered renavigations on the Web.

Moreover, all three callers pass UTF-8, so it's pointless to support other encodings here.

Instead of misusing a mechanism intended for something else, I suggest either:

  1. Making the part of mailnews that generates the UTF-8 HTML representation to be fed to the HTML parser start with the UTF-8 BOM.
  2. Making the HTML parser itself detect mailnews-provided channels in the same place where resource: URLs are currently detected and forced to UTF-8.

As Henri pointed out, the use of setDisplayCharset("UTF-8") is not required. Mailnews already follows suggestion 1 to prepend the UTF-8 BOM:
https://searchfox.org/comm-central/rev/a5e0b43873663e93584fc6e5de31ec9e9d115b02/mailnews/mime/emitters/nsMimeHtmlEmitter.cpp#314
So as far as we can see, a removal is all that's required. At least messages can be displayed again and bug 1745094 will likely be fixed.

Attachment #9254956 - Flags: review?(geoff)
Attachment #9254956 - Flags: review?(geoff) → review+
Assignee: nobody → rachel
Status: NEW → ASSIGNED
Target Milestone: --- → 97 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/e5077d2089c9
Remove needless nsIMessenger.setDisplayCharset(). r=darktrojan

Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED

We should also remove this rather confusing comment: https://hg.mozilla.org/comm-central/rev/e5077d2089c9#l2.47

Please do in a quick follow-up!

Blocks: 1745094
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/ae5adbac7f4a
follow-up - remove obsolete confusing comment. rs=me
You need to log in before you can comment on or make changes to this bug.