tests: move test_cmp_rev to test-lib-functions
[gitweb.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index a544f15456656df642253533eaa28885ce3496a6..5c61bbe1131e7bbdd939c8b815bd5222b872e3fb 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -353,7 +353,7 @@ int strbuf_add_wrapped_text(struct strbuf *buf,
 
                c = *text;
                if (!c || isspace(c)) {
-                       if (w < width || !space) {
+                       if (w <= width || !space) {
                                const char *start = bol;
                                if (!c && text == start)
                                        return w;
@@ -423,6 +423,13 @@ int is_encoding_utf8(const char *name)
        return 0;
 }
 
+int same_encoding(const char *src, const char *dst)
+{
+       if (is_encoding_utf8(src) && is_encoding_utf8(dst))
+               return 1;
+       return !strcasecmp(src, dst);
+}
+
 /*
  * Given a buffer and its encoding, return it re-encoded
  * with iconv.  If the conversion fails, returns NULL.