summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7cbcf4d)
raw | patch | inline | side by side (parent: 7cbcf4d)
author | Junio C Hamano <junkio@cox.net> | |
Sat, 30 Dec 2006 20:20:43 +0000 (12:20 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 30 Dec 2006 23:58:43 +0000 (15:58 -0800) |
People can spell config.commitencoding differently from what we
internally have ("utf-8") to mean UTF-8. Try to accept them and
treat them equally.
Signed-off-by: Junio C Hamano <junkio@cox.net>
internally have ("utf-8") to mean UTF-8. Try to accept them and
treat them equally.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-commit-tree.c | patch | blob | history | |
utf8.c | patch | blob | history | |
utf8.h | patch | blob | history |
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c
index 146aaffd282987454c0910477cfe7a047f478e94..0651e5927e836d22246d84020576ccb3069b6c5d 100644 (file)
--- a/builtin-commit-tree.c
+++ b/builtin-commit-tree.c
}
/* Not having i18n.commitencoding is the same as having utf-8 */
- encoding_is_utf8 = (!git_commit_encoding ||
- !strcmp(git_commit_encoding, "utf-8"));
+ encoding_is_utf8 = is_encoding_utf8(git_commit_encoding);
init_buffer(&buffer, &size);
add_buffer(&buffer, &size, "tree %s\n", sha1_to_hex(tree_sha1));
index 1eedd8b61aeed9867366df0b70ac849cdef985b9..7c80eeccb4537ab6d4387941c6262c89cab30d33 100644 (file)
--- a/utf8.c
+++ b/utf8.c
}
}
+int is_encoding_utf8(const char *name)
+{
+ if (!name)
+ return 1;
+ if (!strcasecmp(name, "utf-8") || !strcasecmp(name, "utf8"))
+ return 1;
+ return 0;
+}
+
/*
* Given a buffer and its encoding, return it re-encoded
* with iconv. If the conversion fails, returns NULL.
index cae2a8e665c2cbe7bf31a49deed84250eaa37a33..a07c5a88af63d41ae963f230510a33d78b68a525 100644 (file)
--- a/utf8.h
+++ b/utf8.h
int utf8_width(const char **start);
int is_utf8(const char *text);
+int is_encoding_utf8(const char *name);
+
void print_wrapped_text(const char *text, int indent, int indent2, int len);
#ifndef NO_ICONV