Open Bug 1739609 Opened 3 years ago Updated 11 months ago

Repair Text Encoding doesn't repair Subject

Categories

(MailNews Core :: Internationalization, defect)

Thunderbird 94
Desktop
All
defect

Tracking

(thunderbird_esr102+, thunderbird102+ affected)

Tracking Status
thunderbird_esr102 + ---
thunderbird102 + affected

People

(Reporter: freaktechnik, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

"Repair Text Encoding" only tries to detect the encoding of body parts of the message. The old encoding override infrastructure would also override the encoding for at least some headers. Since we're doing auto detection per parsed text chunk, we would probably do auto detection per header.

Attached file testRussian.eml

While looking at this bug, we noticed that a detected charset, either when displaying a message or when repairing the charset, isn't always shown correctly in the UI. You need to use https://addons.thunderbird.net/en-US/thunderbird/addon/charset-menu/ to see the problem.
Here's a test message with no charset which comes from bug 1734361 and originally was a news message with no charset information. It is deliberately attached as text/plain so it can be viewed without downloading, see bug 1713786 comment #41. That bug also has another sample message in attachment 9244412 [details].
We fixed this problem here:
https://github.com/Betterbird/thunderbird-patches/blob/main/91/bugs/1739609-more-charset-issues.patch

We added more hunks to the patch quoted in comment #1 to fix the subject both in the header pane and in the thread pane. This is rather hacky.

For the record, we tried to correct the subject here
https://searchfox.org/comm-central/rev/87a21a6208d23b85f4bf2b240ac3fa79a811db72/mailnews/mime/src/mimetext.cpp#346
after the charset has been detected. Using this debug code

    // Fix the subject header.
    char* subject = MimeHeaders_get(obj->headers, HEADER_SUBJECT, false, false);
    printf("=== subject |%s|\n", subject);
    obj->headers->all_headers = strdup("Subject: klops\r\n");
    obj->headers->all_headers_fp = 18;
    obj->headers->all_headers_size = 19;
    obj->headers->heads_size = 1;
    obj->headers->heads[0] = obj->headers->all_headers;
    printf("=== subject 2 |%s|\n", MimeHeaders_get(obj->headers, HEADER_SUBJECT, false, false));

we managed to set a new subject in the MIME headers (there doesn't appear to be an API to do so), but that had no effect on the message display. Hence the idea to set the subject later in MailSetCharacterSet(). Instead of a timeout, ideally that code should wait for the message display to complete.

Flags: needinfo?(mkmelin+mozilla)

Looked at the patch, and idk. I'm inclined to not take it. It's a fair amount of hacky code for quite an edge case.

Flags: needinfo?(mkmelin+mozilla)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: