From: Junio C Hamano Date: Fri, 7 Dec 2012 22:10:56 +0000 (-0800) Subject: Merge branch 'jc/same-encoding' into maint X-Git-Tag: v1.8.1-rc1~2^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fff26a68053022a2cbc39142c7c6f6d016837058;p=git Merge branch 'jc/same-encoding' into maint 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() --- fff26a68053022a2cbc39142c7c6f6d016837058 diff --cc builtin/mailinfo.c index da231400b3,90b158d4f5..24a772d8e1 --- 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)