aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuresh Chandrasekharan <suresh.chandrasekharan@sun.com>2003-08-21 09:27:10 +0800
committerSuresh Chandrasekharan <kcsuresh@src.gnome.org>2003-08-21 09:27:10 +0800
commit8d6bc9e331468a7da3f9ea32fc1d1a2f34a7ffe1 (patch)
tree61b0c899ac4f17a05deee9e64597f686e84daa28
parent5440e6d4c1e7421ff659f53486ed4a7de217a74b (diff)
downloadgsoc2013-evolution-8d6bc9e331468a7da3f9ea32fc1d1a2f34a7ffe1.tar.gz
gsoc2013-evolution-8d6bc9e331468a7da3f9ea32fc1d1a2f34a7ffe1.tar.zst
gsoc2013-evolution-8d6bc9e331468a7da3f9ea32fc1d1a2f34a7ffe1.zip
Fix for 47474 e_filename_make_safe routine not utf8 friendly.
2003-08-20 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com> * 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
-rw-r--r--e-util/e-util.c17
1 files 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<p)
+ *ts++ = '_';
+ }
}
}