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>
Brandon Casey committed
May 18, 2009 at 18:44 UTC
ed1e3985e445e4cb4558056f8a31c366f2bf2634
1 file changed
+2
-4
builtin-mailinfo.c
+2
-4
@@ -193,8 +193,7 @@ static void handle_content_type(struct strbuf *line)
193
*content_top = boundary;
194
boundary = NULL;
195
}
196
- if (slurp_attr(line->buf, "charset=", &charset))
197
- strbuf_tolower(&charset);
196
+ slurp_attr(line->buf, "charset=", &charset);
197
198
if (boundary) {
199
strbuf_release(boundary);
@@ -494,7 +493,7 @@ static void convert_to_utf8(struct strbuf *line, const char *charset)
493
return;
494
}
495
497
- if (!strcmp(metainfo_charset, charset))
496
+ if (!strcasecmp(metainfo_charset, charset))
497
return;
498
out = reencode_string(line->buf, metainfo_charset, charset);
499
if (!out)
@@ -550,7 +549,6 @@ static int decode_header_bq(struct strbuf *it)
549
if (cp + 3 - it->buf > it->len)
550
goto decode_header_bq_out;
551
strbuf_add(&charset_q, ep, cp - ep);
553
- strbuf_tolower(&charset_q);
552
553
encoding = cp[1];
554
if (!encoding || cp[2] != '?')