From 8d6bc9e331468a7da3f9ea32fc1d1a2f34a7ffe1 Mon Sep 17 00:00:00 2001 From: Suresh Chandrasekharan Date: Thu, 21 Aug 2003 01:27:10 +0000 Subject: Fix for 47474 e_filename_make_safe routine not utf8 friendly. 2003-08-20 Suresh Chandrasekharan * gal/util/e-util.c (e_filename_make_safe): Fix for 47474 e_filename_make_safe routine not utf8 friendly. svn path=/trunk/; revision=22321 --- e-util/e-util.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/e-util/e-util.c b/e-util/e-util.c index 955151dcc5..2514cfc931 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -418,13 +418,20 @@ e_strstrcase (const gchar *haystack, const gchar *needle) void e_filename_make_safe (gchar *string) { - gchar *p; + gchar *p, *ts; + gunichar c; g_return_if_fail (string != NULL); - - for (p = string; *p; p++) { - if (!isprint ((unsigned char)*p) || strchr (" /'\"`&();|<>$%{}!", *p)) - *p = '_'; + p = string; + + while(p && *p) { + c = g_utf8_get_char (p); + ts = p; + p = g_utf8_next_char (p); + if (!g_unichar_isprint(c) || ( c < 0xff && strchr (" /'\"`&();|<>$%{}!", c&0xff ))) { + while (ts