From: Junio C Hamano Date: Thu, 15 Nov 2012 18:24:05 +0000 (-0800) Subject: Merge branch 'jc/same-encoding' X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6b8731258d06001217254ef67a3553d3fe601737;p=git.git Merge branch 'jc/same-encoding' Various codepaths checked if two encoding names are the same using ad-hoc code and some of them ended up asking iconv() to convert between "utf8" and "UTF-8". The former is not a valid way to spell the encoding name, but often people use it by mistake, and we equated them in some but not all codepaths. Introduce a new helper function to make these codepaths consistent. * jc/same-encoding: reencode_string(): introduce and use same_encoding() Conflicts: builtin/mailinfo.c --- 6b8731258d06001217254ef67a3553d3fe601737 diff --cc builtin/mailinfo.c index da231400b,90b158d4f..24a772d8e --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@@ -481,9 -501,13 +481,10 @@@ static void convert_to_utf8(struct strb { char *out; - if (!charset || !*charset) { - charset = guess_charset(line, metainfo_charset); - if (!charset) - return; - } + if (!charset || !*charset) + return; - if (!strcasecmp(metainfo_charset, charset)) + + if (same_encoding(metainfo_charset, charset)) return; out = reencode_string(line->buf, metainfo_charset, charset); if (!out)