aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-10-13 10:29:25 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-13 10:29:25 +0800
commitb6d1043499d87d579d8a3cfb422df9a688dbb15e (patch)
tree40b26b80321ea8820e822b99caf4e45e4ade37d2
parent8a59f7a4e9f845ea14a98f7243b332cdd39e9671 (diff)
downloadgsoc2013-evolution-b6d1043499d87d579d8a3cfb422df9a688dbb15e.tar
gsoc2013-evolution-b6d1043499d87d579d8a3cfb422df9a688dbb15e.tar.gz
gsoc2013-evolution-b6d1043499d87d579d8a3cfb422df9a688dbb15e.tar.bz2
gsoc2013-evolution-b6d1043499d87d579d8a3cfb422df9a688dbb15e.tar.lz
gsoc2013-evolution-b6d1043499d87d579d8a3cfb422df9a688dbb15e.tar.xz
gsoc2013-evolution-b6d1043499d87d579d8a3cfb422df9a688dbb15e.tar.zst
gsoc2013-evolution-b6d1043499d87d579d8a3cfb422df9a688dbb15e.zip
Fix for Debian systems which apparently can use a ';' as a codeset
2001-10-12 Jeffrey Stedfast <fejj@ximian.com> * gal/util/e-iconv.c (e_iconv_init): Fix for Debian systems which apparently can use a ';' as a codeset terminator? Cleaned up the code in the process, the parser is a little nicer now. svn path=/trunk/; revision=13650
-rw-r--r--e-util/e-iconv.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/e-util/e-iconv.c b/e-util/e-iconv.c
index 77a7e0b8e6..99c6c888d5 100644
--- a/e-util/e-iconv.c
+++ b/e-util/e-iconv.c
@@ -225,17 +225,19 @@ e_iconv_init(int keep)
* codeset is a character set or encoding identifier like
* ISO-8859-1 or UTF-8.
*/
- char *p;
- int len;
+ char *codeset, *p;
- p = strchr (locale, '@');
- if (p == NULL)
- p = strchr (locale, '/'); /* This is a hack for Solaris systems */
-
- len = p ? (p - locale) : strlen (locale);
- if ((p = strchr (locale, '.'))) {
- locale_charset = g_strndup (p + 1, len - (p - locale) + 1);
+ codeset = strchr (locale, '.');
+ if (codeset) {
+ codeset++;
+
+ /* ; is a hack for debian systems and / is a hack for Solaris systems */
+ for (p = codeset; *p && !strchr ("@;/", *p); p++);
+ locale_charset = g_strndup (codeset, p - codeset);
g_strdown (locale_charset);
+ } else {
+ /* charset unknown */
+ locale_charset = NULL;
}
#endif
}
@@ -327,8 +329,8 @@ iconv_t e_iconv_open(const char *oto, const char *ofrom)
if (oto == NULL || ofrom == NULL)
return (iconv_t)-1;
- to = e_iconv_charset_name(oto);
- from = e_iconv_charset_name(ofrom);
+ to = e_iconv_charset_name (oto);
+ from = e_iconv_charset_name (ofrom);
tofrom = alloca(strlen(to) +strlen(from) + 2);
sprintf(tofrom, "%s%%%s", to, from);