pretty: support padding placeholders, %< %> and %><
[git/git.git] / utf8.h
CommitLineData
9e832665
JS
1#ifndef GIT_UTF8_H
2#define GIT_UTF8_H
3
396ccf1f
JH
4typedef unsigned int ucs_char_t; /* assuming 32bit int */
5
44b25b87 6int utf8_width(const char **start, size_t *remainder_p);
2bc1e7ec 7int utf8_strnwidth(const char *string, int len, int skip_ansi);
8a9391e9 8int utf8_strwidth(const char *string);
9e832665 9int is_utf8(const char *text);
677cfed5 10int is_encoding_utf8(const char *name);
0e18bcd5 11int same_encoding(const char *, const char *);
c0821965 12int utf8_fprintf(FILE *, const char *, ...);
677cfed5 13
e0db1765 14void strbuf_add_wrapped_text(struct strbuf *buf,
a94410c8 15 const char *text, int indent, int indent2, int width);
e0db1765 16void strbuf_add_wrapped_bytes(struct strbuf *buf, const char *data, int len,
98acc837 17 int indent, int indent2, int width);
9e832665 18
b45974a6 19#ifndef NO_ICONV
b782bbab
NTND
20char *reencode_string_iconv(const char *in, size_t insz,
21 iconv_t conv, int *outsz);
22char *reencode_string_len(const char *in, int insz,
23 const char *out_encoding,
24 const char *in_encoding,
25 int *outsz);
b45974a6 26#else
b782bbab 27#define reencode_string_len(a,b,c,d,e) NULL
b45974a6
JH
28#endif
29
b782bbab
NTND
30static inline char *reencode_string(const char *in,
31 const char *out_encoding,
32 const char *in_encoding)
33{
34 return reencode_string_len(in, strlen(in),
35 out_encoding, in_encoding,
36 NULL);
37}
38
6cd3c053
KS
39int mbs_chrlen(const char **text, size_t *remainder_p, const char *encoding);
40
9e832665 41#endif