diff options
Diffstat (limited to 'src/shape.c')
-rw-r--r-- | src/shape.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/shape.c b/src/shape.c index 31d02ed..74112b0 100644 --- a/src/shape.c +++ b/src/shape.c @@ -144,16 +144,24 @@ static UNUSED void debug_log_attrs(size_t len_chars, const char *text, PangoLogAttr *log_attrs) { int i; + const gchar *p = text; + + if ( !g_utf8_validate(text, -1, NULL) ) { + fprintf(stderr, "Invalid UTF8!\n"); + return; + } for ( i=0; i<len_chars; i++ ) { - if ( text[i] == '\n' ) { + gunichar c = g_utf8_get_char(p); + p = g_utf8_next_char(p); + if ( c == '\n' ) { printf("`"); } else { - printf("%c", text[i]); + printf("%lc", c); } } printf("\n"); - for ( i=0; i<len_chars; i++ ) { + for ( i=0; i<=len_chars; i++ ) { if ( log_attrs[i].is_line_break ) { if ( log_attrs[i].is_mandatory_break ) { printf("n"); |