From 330db18c0277dcfcf322bb61c688acfb5ddf3867 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Mon, 18 May 2009 18:44:39 -0500 Subject: Use 'UTF-8' rather than 'utf-8' everywhere for backward compatibility Some ancient platforms (Solaris 7, IRIX 6.5) do not understand 'utf-8', but all tested implementations understand 'UTF-8'. Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- builtin-mailinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin-mailinfo.c') diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c index 1eeeb4de6d..5ebc8b53cc 100644 --- a/builtin-mailinfo.c +++ b/builtin-mailinfo.c @@ -944,7 +944,7 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix) */ git_config(git_default_config, NULL); - def_charset = (git_commit_encoding ? git_commit_encoding : "utf-8"); + def_charset = (git_commit_encoding ? git_commit_encoding : "UTF-8"); metainfo_charset = def_charset; while (1 < argc && argv[1][0] == '-') { -- cgit 1.2.3-korg From ed1e3985e445e4cb4558056f8a31c366f2bf2634 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Mon, 18 May 2009 18:44:40 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- builtin-mailinfo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'builtin-mailinfo.c') diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c index 5ebc8b53cc..c68187e2e9 100644 --- a/builtin-mailinfo.c +++ b/builtin-mailinfo.c @@ -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] != '?') -- cgit 1.2.3-korg From 62645006044c7453439f6ad8dafc984441ac54b6 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Mon, 18 May 2009 18:44:41 -0500 Subject: builtin-mailinfo.c: use "ISO8859-1" instead of "latin1" as fallback encoding Some platforms do not understand the character encoding "latin1" which is another name for "ISO8859-1". So use "ISO8859-1" instead which all tested platforms understand. Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- builtin-mailinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin-mailinfo.c') diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c index c68187e2e9..92637ac0ba 100644 --- a/builtin-mailinfo.c +++ b/builtin-mailinfo.c @@ -480,7 +480,7 @@ static const char *guess_charset(const struct strbuf *line, const char *target_c if (is_utf8(line->buf)) return NULL; } - return "latin1"; + return "ISO8859-1"; } static void convert_to_utf8(struct strbuf *line, const char *charset) -- cgit 1.2.3-korg