aboutsummaryrefslogtreecommitdiff
path: root/src/shape.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2015-08-18 23:01:00 +0200
committerThomas White <taw@bitwiz.org.uk>2015-08-18 23:12:51 +0200
commit28fe5ce820b37428901cd504b5ff057c992365d9 (patch)
tree089377eea61cde4d2f8d28426316f082f471104d /src/shape.c
parent6ad8d3167c90954970f4015379d93050e3ff8ae8 (diff)
Fix debug_log_attrs()
Diffstat (limited to 'src/shape.c')
-rw-r--r--src/shape.c14
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");