aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-10-18 22:41:56 -0700
committerJeff King <peff@peff.net>2012-11-04 08:10:33 -0500
commit0e18bcd5e937b9e5857892e7f5c80c3c5b1da5d4 (patch)
tree65ec6c8c507979ede028373a036d21c6c11ce49c /builtin
parent7e2010537e96d0a1144520222f20ba1dc3d61441 (diff)
downloadgit-0e18bcd5e937b9e5857892e7f5c80c3c5b1da5d4.tar.gz
git-0e18bcd5e937b9e5857892e7f5c80c3c5b1da5d4.tar.xz
reencode_string(): introduce and use same_encoding()
Callers of reencode_string() that re-encodes a string from one encoding to another all used ad-hoc way to bypass the case where the input and the output encodings are the same. Some did strcmp(), some did strcasecmp(), yet some others when converting to UTF-8 used is_encoding_utf8(). Introduce same_encoding() helper function to make these callers use the same logic. Notably, is_encoding_utf8() has a work-around for common misconfiguration to use "utf8" to name UTF-8 encoding, which does not match "UTF-8" hence strcasecmp() would not consider the same. Make use of it in this helper function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/mailinfo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index fe128572f..90b158d4f 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -507,7 +507,7 @@ static void convert_to_utf8(struct strbuf *line, const char *charset)
return;
}
- if (!strcasecmp(metainfo_charset, charset))
+ if (same_encoding(metainfo_charset, charset))
return;
out = reencode_string(line->buf, metainfo_charset, charset);
if (!out)