Skip to content

Commit

Permalink
jmap_mail.c: set charset=utf-8 for any text content from BodyValue
Browse files Browse the repository at this point in the history
  • Loading branch information
rsto committed Jul 24, 2024
1 parent 59238dc commit f635f45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cassandane/tiny-tests/JMAPEmail/email_set_create_encoding
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ sub test_email_set_create_encoding
},
wantEncoding => 'quoted-printable',
wantContentType => 'text/html',
}, {
desc => 'text/html UTF-8 without charset from EmailBodyValue',
bodyValue => "some \N{TOMATO} utf-8",
bodyStructure => {
type => 'text/html',
},
wantEncoding => 'quoted-printable',
wantContentType => 'text/html; charset=utf-8'
});

my @rfc822Tests = ({
Expand Down
2 changes: 1 addition & 1 deletion imap/jmap_mail.c
Original file line number Diff line number Diff line change
Expand Up @@ -10801,7 +10801,7 @@ static void _emailpart_body_to_mime(jmap_req_t *req, struct jmap_parser *parser,

// Set charset for plain text EmailBodyValues if required
if (!part->charset && part->part_id &&
!strcasecmp(media_subtype, "plain") &&
// XXX !strcasecmp(media_subtype, "plain") &&
(body_flags & MIMEBODY_HAS_NON_ASCII)) {
part->charset = xstrdup("utf-8");
}
Expand Down

0 comments on commit f635f45

Please sign in to comment.