commit-tree: encourage UTF-8 commit messages.

Introduce is_utf() to check if a text looks like it is encoded
in UTF-8, utf8_width() to count display width, and implements
print_wrapped_text() using them.

git-commit-tree warns if the commit message does not minimally
conform to the UTF-8 encoding when i18n.commitencoding is either
unset, or set to "utf-8".

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Johannes Schindelin
2006-12-22 22:06:08 +01:00
committed by Junio C Hamano
parent 8e554429e8
commit 9e83266525
4 changed files with 303 additions and 4 deletions

8
utf8.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef GIT_UTF8_H
#define GIT_UTF8_H
int utf8_width(const char **start);
int is_utf8(const char *text);
void print_wrapped_text(const char *text, int indent, int indent2, int len);
#endif