From c082196575e13dd5960031f213b20e2df989ca18 Mon Sep 17 00:00:00 2001 From: Jiang Xin Date: Sat, 9 Feb 2013 14:31:09 +0800 Subject: Add utf8_fprintf helper that returns correct number of columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since command usages can be translated, they may include utf-8 encoded strings, and the output in console may not align well any more. This is because strlen() is different from strwidth() on utf-8 strings. A wrapper utf8_fprintf() can help to return the correct number of columns required. Signed-off-by: Jiang Xin Signed-off-by: Nguyễn Thái Ngọc Duy Reviewed-by: Torsten Bögershausen Signed-off-by: Junio C Hamano --- utf8.h | 1 + 1 file changed, 1 insertion(+) (limited to 'utf8.h') diff --git a/utf8.h b/utf8.h index 93ef60042c..3ca85c7737 100644 --- a/utf8.h +++ b/utf8.h @@ -8,6 +8,7 @@ int utf8_strwidth(const char *string); int is_utf8(const char *text); int is_encoding_utf8(const char *name); int same_encoding(const char *, const char *); +int utf8_fprintf(FILE *, const char *, ...); int strbuf_add_wrapped_text(struct strbuf *buf, const char *text, int indent, int indent2, int width); -- cgit v1.2.3