changeset 13156:44188ee27d59

[gaim-migrate @ 15519] Given that the timezone is coming from the locale, it might be non-ASCII. Let's make sure to escape everything. This seems like the cleanest and most portable way of dealing with the filename encoding. As these are logs, I'd like their names to be all ASCII, to avoid problems when moving them between filesystems with different encodings. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 07 Feb 2006 09:50:06 +0000
parents fae5a5517f18
children 3a97c65196d1
files src/log.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/log.c	Tue Feb 07 09:41:22 2006 +0000
+++ b/src/log.c	Tue Feb 07 09:50:06 2006 +0000
@@ -637,7 +637,7 @@
 
 		filename = g_strdup_printf("%s%s", date, ext ? ext : "");
 
-		path = g_build_filename(dir, filename, NULL);
+		path = g_build_filename(dir, gaim_escape_filename(filename), NULL);
 		g_free(dir);
 		g_free(filename);
 
@@ -664,7 +664,7 @@
 {
 	GDir *dir;
 	GList *list = NULL;
-	const char *filename;
+	const char *fname;
 	char *path;
 
 	if(!account)
@@ -680,8 +680,10 @@
 		return NULL;
 	}
 
-	while ((filename = g_dir_read_name(dir)))
+	while ((fname = g_dir_read_name(dir)))
 	{
+		const char *filename = gaim_unescape_filename(fname);
+
 		if (gaim_str_has_suffix(filename, ext) &&
 		    strlen(filename) >= (17 + strlen(ext)))
 		{
@@ -886,7 +888,7 @@
 
 		gaim_build_dir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
 
-		filename = g_build_filename(dir, date, NULL);
+		filename = g_build_filename(dir, gaim_escape_filename(date), NULL);
 		g_free(dir);
 
 		log->logger_data = g_fopen(filename, "a");