git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/8] Use 'UTF-8' rather than 'utf-8' everywhere for backward compatibility

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
May 18, 2009, 23:44 UTC
Message-ID
<KfeKNR3Jm6YKvPIcYGBMpLkRr97IFN82BZR2bJNHFQYwhjGgwGRoIAkKO5m1EZb7M9epcX8P-fk@cipher.nrlssc.navy.mil>
In-Reply-To
<KfeKNR3Jm6YKvPIcYGBMpKjNOsMcmMNMJ1vr-EBr-eE371H-Rg69NOM1rMB2Oa5nCGVe2SMGKdc@cipher.nrlssc.navy.mil>

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 <casey@nrlssc.navy.mil>
---
 builtin-log.c      |    2 +-
 builtin-mailinfo.c |    2 +-
 builtin-revert.c   |    4 ++--
 pretty.c           |    4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 5eaec5d..58db959 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -619,7 +619,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
 	struct shortlog log;
 	struct strbuf sb = STRBUF_INIT;
 	int i;
-	const char *encoding = "utf-8";
+	const char *encoding = "UTF-8";
 	struct diff_options opts;
 	int need_8bit_cte = 0;
 	struct commit *commit = NULL;
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 1eeeb4d..5ebc8b5 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] == '-') {
diff --git a/builtin-revert.c b/builtin-revert.c
index 3f2614e..ae01395 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -323,9 +323,9 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 
 	encoding = get_encoding(message);
 	if (!encoding)
-		encoding = "utf-8";
+		encoding = "UTF-8";
 	if (!git_commit_encoding)
-		git_commit_encoding = "utf-8";
+		git_commit_encoding = "UTF-8";
 	if ((reencoded_message = reencode_string(message,
 					git_commit_encoding, encoding)))
 		message = reencoded_message;
diff --git a/pretty.c b/pretty.c
index a0ef356..e5328da 100644
--- a/pretty.c
+++ b/pretty.c
@@ -284,7 +284,7 @@ static char *replace_encoding_header(char *buf, const char *encoding)
 static char *logmsg_reencode(const struct commit *commit,
 			     const char *output_encoding)
 {
-	static const char *utf8 = "utf-8";
+	static const char *utf8 = "UTF-8";
 	const char *use_encoding;
 	char *encoding;
 	char *out;
@@ -881,7 +881,7 @@ char *reencode_commit_message(const struct commit *commit, const char **encoding
 		    ? git_log_output_encoding
 		    : git_commit_encoding);
 	if (!encoding)
-		encoding = "utf-8";
+		encoding = "UTF-8";
 	if (encoding_p)
 		*encoding_p = encoding;
 	return logmsg_reencode(commit, encoding);
-- 
1.6.3.1.24.g152f4
Previous: Brandon CaseyNext: Brandon Casey
Message 3 of 9 in “character encoding portability updates”
  1. 0/8 character encoding portability updatesBrandon Casey, May 18, 2009
  2. 1/8 t3900: use ancient iconv names for backward compatibilityBrandon Casey, May 18, 2009
  3. 2/8 Use 'UTF-8' rather than 'utf-8' everywhere for backward compatibilityBrandon Casey, May 18, 2009
  4. 3/8 builtin-mailinfo.c: compare character encodings case insensitivelyBrandon Casey, May 18, 2009
  5. 4/8 builtin-mailinfo.c: use "ISO8859-1" instead of "latin1" as fallback encodingBrandon Casey, May 18, 2009
  6. 5/8 t3901: avoid negation on right hand side of '|'Brandon Casey, May 18, 2009
  7. 6/8 t3901: Use ISO8859-1 instead of ISO-8859-1 for backward compatibilityBrandon Casey, May 18, 2009
  8. 7/8 t9301: use ISO8859-1 rather than ISO-8859-1Brandon Casey, May 18, 2009
  9. 8/8 t5100: use ancient encoding syntax for backwards compatibilityBrandon Casey, May 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.