changeset 647:42d36db921bc

Ensure that we end with UTF8 encoded comment and keywords.
author zas_
date Tue, 13 May 2008 07:34:37 +0000
parents 91dfc98f3ca1
children e34c1002e553
files src/bar_info.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar_info.c	Mon May 12 23:26:00 2008 +0000
+++ b/src/bar_info.c	Tue May 13 07:34:37 2008 +0000
@@ -173,7 +173,12 @@
 				{
 				while (*ptr != '\n' && *ptr != '\0') ptr++;
 				*ptr = '\0';
-				if (strlen(s_buf) > 0) list = g_list_prepend(list, g_strdup(s_buf));
+				if (strlen(s_buf) > 0)
+					{
+					gchar *kw = utf8_validate_or_convert(g_strdup(s_buf));
+
+					list = g_list_prepend(list, kw);
+					}
 				}
 				break;
 			case MK_COMMENT:
@@ -198,7 +203,10 @@
 			len = strlen(ptr);
 			while (len > 0 && ptr[len - 1] == '\n') len--;
 			if (ptr[len] == '\n') len++; /* keep the last one */
-			if (len > 0) *comment = g_strndup(ptr, len);
+			if (len > 0)
+				{
+				*comment = utf8_validate_or_convert(g_strndup(ptr, len));
+				}
 			}
 		g_string_free(comment_build, TRUE);
 		}