mirror of
https://github.com/git/git.git
synced 2025-03-20 00:28:49 +00:00
builtin-mailinfo.c: compare character encodings case insensitively
When converting between character encodings, git tests whether the "from" encoding and the "to" encoding have the same name. git should perform this test case insensitively so that e.g. utf-8 is not seen as a different encoding than UTF-8. Additionally, it is not necessary to call tolower() anymore on the encodings extracted from the mail message. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
330db18c02
commit
ed1e3985e4
@ -193,8 +193,7 @@ static void handle_content_type(struct strbuf *line)
|
||||
*content_top = boundary;
|
||||
boundary = NULL;
|
||||
}
|
||||
if (slurp_attr(line->buf, "charset=", &charset))
|
||||
strbuf_tolower(&charset);
|
||||
slurp_attr(line->buf, "charset=", &charset);
|
||||
|
||||
if (boundary) {
|
||||
strbuf_release(boundary);
|
||||
@ -494,7 +493,7 @@ static void convert_to_utf8(struct strbuf *line, const char *charset)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(metainfo_charset, charset))
|
||||
if (!strcasecmp(metainfo_charset, charset))
|
||||
return;
|
||||
out = reencode_string(line->buf, metainfo_charset, charset);
|
||||
if (!out)
|
||||
@ -550,7 +549,6 @@ static int decode_header_bq(struct strbuf *it)
|
||||
if (cp + 3 - it->buf > it->len)
|
||||
goto decode_header_bq_out;
|
||||
strbuf_add(&charset_q, ep, cp - ep);
|
||||
strbuf_tolower(&charset_q);
|
||||
|
||||
encoding = cp[1];
|
||||
if (!encoding || cp[2] != '?')
|
||||
|
Loading…
x
Reference in New Issue
Block a user