+2005-02-01 [paul] 1.0.0cvs24.2
+
+ * src/addrbook.c
+ * src/addrindex.c
+ * src/alertpanel.h
+ * src/codeconv.c
+ * src/codeconv.h
+ * src/compose.c
+ * src/export.c
+ * src/folder_item_prefs.c
+ * src/html.c
+ * src/imap.c
+ * src/import.c
+ * src/jpilot.c
+ * src/mainwindow.c
+ * src/matcher_parser_lex.l
+ * src/messageview.c
+ * src/mh.c
+ * src/prefs_account.c
+ * src/prefs_actions.c
+ * src/prefs_common.c
+ * src/prefs_gtk.c
+ * src/prefs_gtk.h
+ * src/prefs_themes.c
+ * src/procheader.c
+ * src/procmime.c
+ * src/sourcewindow.c
+ * src/statusbar.c
+ * src/summaryview.c
+ * src/textview.c
+ * src/toolbar.c
+ * src/unmime.c
+ * src/common/template.c
+ * src/common/utils.c
+ * src/common/xml.c
+ * src/common/xml.h
+ * src/gtk/gtkaspell.c
+ * src/plugins/clamav/clamav_plugin.c
+ * src/plugins/dillo_viewer/dillo_prefs.c
+ * src/plugins/image_viewer/viewerprefs.c
+ * src/plugins/pgpmime/passphrase.c
+ * src/plugins/pgpmime/prefs_gpg.c
+ * src/plugins/pgpmime/select-keys.c
+ * src/plugins/spamassassin/spamassassin.c
+ second part of initial sync with main-gtk2
+ (more to follow)
+
2005-01-31 [colin] 1.0.0cvs24.1
* src/compose.c
( cvs diff -u -r 1.207.2.27 -r 1.207.2.28 src/folderview.c; ) > 1.0.0cvs23.1.patchset
( cvs diff -u -r 1.61.2.20 -r 1.61.2.21 src/account.c; cvs diff -u -r 1.12.2.18 -r 1.12.2.19 src/action.c; cvs diff -u -r 1.9.2.2 -r 1.9.2.3 src/addressadd.c; cvs diff -u -r 1.60.2.13 -r 1.60.2.14 src/addressbook.c; cvs diff -u -r 1.17.2.9 -r 1.17.2.10 src/alertpanel.c; cvs diff -u -r 1.382.2.90 -r 1.382.2.91 src/compose.c; cvs diff -u -r 1.14.2.4 -r 1.14.2.5 src/editaddress.c; cvs diff -u -r 1.5.12.1 -r 1.5.12.2 src/editbook.c; cvs diff -u -r 1.11.2.4 -r 1.11.2.5 src/editgroup.c; cvs diff -u -r 1.5.12.1 -r 1.5.12.2 src/editjpilot.c; cvs diff -u -r 1.8.2.2 -r 1.8.2.3 src/editldap.c; cvs diff -u -r 1.10.2.2 -r 1.10.2.3 src/editldap_basedn.c; cvs diff -u -r 1.5.12.1 -r 1.5.12.2 src/editvcard.c; cvs diff -u -r 1.8.2.4 -r 1.8.2.5 src/export.c; cvs diff -u -r 1.26.2.10 -r 1.26.2.11 src/foldersel.c; cvs diff -u -r 1.14.2.6 -r 1.14.2.7 src/grouplistdialog.c; cvs diff -u -r 1.13.2.5 -r 1.13.2.6 src/import.c; cvs diff -u -r 1.14.2.2 -r 1.14.2.3 src/importldif.c; cvs diff -u -r 1.149.2.19 -r 1.149.2.20 src/inc.c; cvs diff -u -r 1.115.2.26 -r 1.115.2.27 src/main.c; cvs diff -u -r 1.274.2.28 -r 1.274.2.29 src/mainwindow.c; cvs diff -u -r 1.3.12.6 -r 1.3.12.7 src/message_search.c; cvs diff -u -r 1.94.2.39 -r 1.94.2.40 src/messageview.c; cvs diff -u -r 1.83.2.26 -r 1.83.2.27 src/mimeview.c; cvs diff -u -r 1.60.2.10 -r 1.60.2.11 src/prefs_actions.c; cvs diff -u -r 1.204.2.28 -r 1.204.2.29 src/prefs_common.c; cvs diff -u -r 1.103.2.11 -r 1.103.2.12 src/prefs_common.h; cvs diff -u -r 1.16.2.6 -r 1.16.2.7 src/prefs_customheader.c; cvs diff -u -r 1.16.2.6 -r 1.16.2.7 src/prefs_display_header.c; cvs diff -u -r 1.59.2.13 -r 1.59.2.14 src/prefs_filtering.c; cvs diff -u -r 1.1.4.10 -r 1.1.4.11 src/prefs_filtering_action.c; cvs diff -u -r 1.10.2.9 -r 1.10.2.10 src/prefs_gtk.c; cvs diff -u -r 1.43.2.15 -r 1.43.2.16 src/prefs_matcher.c; cvs diff -u -r 1.10.2.4 -r 1.10.2.5 src/prefs_summary_column.c; cvs diff -u -r 1.12.2.6 -r 1.12.2.7 src/prefs_template.c; cvs diff -u -r 1.9.2.8 -r 1.9.2.9 src/sourcewindow.c; cvs diff -u -r 1.15.2.12 -r 1.15.2.13 src/summary_search.c; cvs diff -u -r 1.395.2.48 -r 1.395.2.49 src/summaryview.c; cvs diff -u -r 1.96.2.39 -r 1.96.2.40 src/textview.c; cvs diff -u -r 1.4.2.5 -r 1.4.2.6 src/gtk/about.c; cvs diff -u -r 1.5.2.6 -r 1.5.2.7 src/gtk/description_window.c; cvs diff -u -r 1.1.4.3 -r 1.1.4.4 src/gtk/gtkshruler.c; cvs diff -u -r 1.5.2.7 -r 1.5.2.8 src/gtk/gtkutils.c; cvs diff -u -r 1.4.2.6 -r 1.4.2.7 src/gtk/gtkutils.h; cvs diff -u -r 1.2.2.3 -r 1.2.2.4 src/gtk/inputdialog.c; cvs diff -u -r 1.1.4.5 -r 1.1.4.6 src/gtk/logwindow.c; cvs diff -u -r 1.12.2.14 -r 1.12.2.15 src/gtk/prefswindow.c; cvs diff -u -r 1.1.4.5 -r 1.1.4.6 src/gtk/progressdialog.c; cvs diff -u -r 1.1.4.3 -r 1.1.4.4 src/gtk/progressdialog.h; ) > 1.0.0cvs23.2.patchset
( cvs diff -u -r 1.382.2.91 -r 1.382.2.92 src/compose.c; ) > 1.0.0cvs24.1.patchset
+( cvs diff -u -r 1.22.2.2 -r 1.22.2.3 src/addrbook.c; cvs diff -u -r 1.28.2.4 -r 1.28.2.5 src/addrindex.c; cvs diff -u -r 1.5.2.2 -r 1.5.2.3 src/alertpanel.h; cvs diff -u -r 1.65.2.20 -r 1.65.2.21 src/codeconv.c; cvs diff -u -r 1.15.2.3 -r 1.15.2.4 src/codeconv.h; cvs diff -u -r 1.382.2.92 -r 1.382.2.93 src/compose.c; cvs diff -u -r 1.8.2.5 -r 1.8.2.6 src/export.c; cvs diff -u -r 1.2.2.4 -r 1.2.2.5 src/folder_item_prefs.c; cvs diff -u -r 1.12.2.5 -r 1.12.2.6 src/html.c; cvs diff -u -r 1.179.2.14 -r 1.179.2.15 src/imap.c; cvs diff -u -r 1.13.2.6 -r 1.13.2.7 src/import.c; cvs diff -u -r 1.18.2.5 -r 1.18.2.6 src/jpilot.c; cvs diff -u -r 1.274.2.29 -r 1.274.2.30 src/mainwindow.c; cvs diff -u -r 1.16.2.2 -r 1.16.2.3 src/matcher_parser_lex.l; cvs diff -u -r 1.94.2.40 -r 1.94.2.41 src/messageview.c; cvs diff -u -r 1.79.2.6 -r 1.79.2.7 src/mh.c; cvs diff -u -r 1.105.2.15 -r 1.105.2.16 src/prefs_account.c; cvs diff -u -r 1.60.2.11 -r 1.60.2.12 src/prefs_actions.c; cvs diff -u -r 1.204.2.29 -r 1.204.2.30 src/prefs_common.c; cvs diff -u -r 1.10.2.10 -r 1.10.2.11 src/prefs_gtk.c; cvs diff -u -r 1.5.2.2 -r 1.5.2.3 src/prefs_gtk.h; cvs diff -u -r 1.3.2.15 -r 1.3.2.16 src/prefs_themes.c; cvs diff -u -r 1.47.2.13 -r 1.47.2.14 src/procheader.c; cvs diff -u -r 1.49.2.30 -r 1.49.2.31 src/procmime.c; cvs diff -u -r 1.9.2.9 -r 1.9.2.10 src/sourcewindow.c; cvs diff -u -r 1.5.2.1 -r 1.5.2.2 src/statusbar.c; cvs diff -u -r 1.395.2.49 -r 1.395.2.50 src/summaryview.c; cvs diff -u -r 1.96.2.40 -r 1.96.2.41 src/textview.c; cvs diff -u -r 1.43.2.13 -r 1.43.2.14 src/toolbar.c; cvs diff -u -r 1.8.2.2 -r 1.8.2.3 src/unmime.c; cvs diff -u -r 1.2.4.3 -r 1.2.4.4 src/common/template.c; cvs diff -u -r 1.36.2.21 -r 1.36.2.22 src/common/utils.c; cvs diff -u -r 1.1.4.5 -r 1.1.4.6 src/common/xml.c; cvs diff -u -r 1.1.4.3 -r 1.1.4.4 src/common/xml.h; cvs diff -u -r 1.9.2.8 -r 1.9.2.9 src/gtk/gtkaspell.c; cvs diff -u -r 1.13.2.4 -r 1.13.2.5 src/plugins/clamav/clamav_plugin.c; cvs diff -u -r 1.5.2.3 -r 1.5.2.4 src/plugins/dillo_viewer/dillo_prefs.c; cvs diff -u -r 1.5.2.3 -r 1.5.2.4 src/plugins/image_viewer/viewerprefs.c; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/pgpmime/passphrase.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/pgpmime/prefs_gpg.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/pgpmime/select-keys.c; cvs diff -u -r 1.18.2.4 -r 1.18.2.5 src/plugins/spamassassin/spamassassin.c; ) > 1.0.0cvs24.2.patchset
BINARY_AGE=0
EXTRA_VERSION=24
EXTRA_RELEASE=
-EXTRA_GTK2_VERSION=.1
+EXTRA_GTK2_VERSION=.2
if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
g_free(fileSpec);
if (pfile) {
fp = pfile->fp;
- fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n",
- conv_get_current_charset_str());
+ fprintf( fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n", CS_INTERNAL );
#endif
addrbook_write_elem_s(fp, 0, AB_ELTAG_ADDRESS_BOOK);
addrbook_write_attr(fp, AB_ATTAG_NAME,
g_free( fileSpec );
if( pfile ) {
fp = pfile->fp;
- fprintf( fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n",
- conv_get_current_charset_str() );
+ fprintf( fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n", CS_INTERNAL );
#endif
addrindex_write_elem_s( fp, 0, TAG_ADDRESS_INDEX );
fputs( ">\n", fp );
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define __ALERTPANEL_H__
#include <glib.h>
-#include <gtk/gtkwindow.h>
typedef enum
{
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2004 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
# include <locale.h>
#endif
+#include <iconv.h>
+
#include "intl.h"
#include "codeconv.h"
#include "unmime.h"
state = JIS_AUXKANJI; \
}
-void conv_jistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_jistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_sjistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf);
+
+static void conv_jistoutf8(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_sjistoutf8(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_euctoutf8(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_anytoutf8(gchar *outbuf, gint outlen, const gchar *inbuf);
+
+static void conv_utf8toeuc(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_utf8tojis(gchar *outbuf, gint outlen, const gchar *inbuf);
+
+static void conv_unreadable_eucjp(gchar *str);
+static void conv_unreadable_8bit(gchar *str);
+static void conv_unreadable_latin(gchar *str);
+
+static void conv_jistodisp(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_sjistodisp(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_euctodisp(gchar *outbuf, gint outlen, const gchar *inbuf);
+
+static void conv_anytodisp(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_ustodisp(gchar *outbuf, gint outlen, const gchar *inbuf);
+static void conv_noconv(gchar *outbuf, gint outlen, const gchar *inbuf);
+
+static void conv_jistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
{
const guchar *in = inbuf;
guchar *out = outbuf;
return 1;
}
-void conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf)
{
const guchar *in = inbuf;
guchar *out = outbuf;
*out = '\0';
}
-void conv_sjistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_sjistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
{
const guchar *in = inbuf;
guchar *out = outbuf;
*out = '\0';
}
-void conv_anytoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_jistoutf8(gchar *outbuf, gint outlen, const gchar *inbuf)
{
- switch (conv_guess_ja_encoding(inbuf)) {
- case C_ISO_2022_JP:
- conv_jistoeuc(outbuf, outlen, inbuf);
- break;
- case C_SHIFT_JIS:
- conv_sjistoeuc(outbuf, outlen, inbuf);
- break;
- default:
+ gchar *eucstr;
+
+ Xalloca(eucstr, outlen, return);
+
+ conv_jistoeuc(eucstr, outlen, inbuf);
+ conv_euctoutf8(outbuf, outlen, eucstr);
+}
+
+static void conv_sjistoutf8(gchar *outbuf, gint outlen, const gchar *inbuf)
+{
+ gchar *tmpstr;
+
+ tmpstr = conv_iconv_strdup(inbuf, CS_SHIFT_JIS, CS_UTF_8);
+ if (tmpstr) {
+ strncpy2(outbuf, tmpstr, outlen);
+ g_free(tmpstr);
+ } else
strncpy2(outbuf, inbuf, outlen);
- break;
- }
}
-void conv_anytoutf8(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_euctoutf8(gchar *outbuf, gint outlen, const gchar *inbuf)
{
- gchar *tmpstr = NULL;
+ static iconv_t cd = (iconv_t)-1;
+ static gboolean iconv_ok = TRUE;
+ gchar *tmpstr;
+
+ if (cd == (iconv_t)-1) {
+ if (!iconv_ok) {
+ strncpy2(outbuf, inbuf, outlen);
+ return;
+ }
+ cd = iconv_open(CS_UTF_8, CS_EUC_JP_MS);
+ if (cd == (iconv_t)-1) {
+ cd = iconv_open(CS_UTF_8, CS_EUC_JP);
+ if (cd == (iconv_t)-1) {
+ g_warning("conv_euctoutf8(): %s\n",
+ g_strerror(errno));
+ iconv_ok = FALSE;
+ strncpy2(outbuf, inbuf, outlen);
+ return;
+ }
+ }
+ }
- switch (conv_guess_ja_encoding(inbuf)) {
- case C_ISO_2022_JP:
- tmpstr = conv_codeset_strdup(inbuf, CS_ISO_2022_JP, CS_UTF_8);
+ tmpstr = conv_iconv_strdup_with_cd(inbuf, cd);
+ if (tmpstr) {
strncpy2(outbuf, tmpstr, outlen);
g_free(tmpstr);
+ } else
+ strncpy2(outbuf, inbuf, outlen);
+}
+
+static void conv_anytoutf8(gchar *outbuf, gint outlen, const gchar *inbuf)
+{
+ switch (conv_guess_ja_encoding(inbuf)) {
+ case C_ISO_2022_JP:
+ conv_jistoutf8(outbuf, outlen, inbuf);
break;
case C_SHIFT_JIS:
- tmpstr = conv_codeset_strdup(inbuf, CS_SHIFT_JIS, CS_UTF_8);
- strncpy2(outbuf, tmpstr, outlen);
- g_free(tmpstr);
+ conv_sjistoutf8(outbuf, outlen, inbuf);
break;
case C_EUC_JP:
- tmpstr = conv_codeset_strdup(inbuf, CS_EUC_JP, CS_UTF_8);
- strncpy2(outbuf, tmpstr, outlen);
- g_free(tmpstr);
+ conv_euctoutf8(outbuf, outlen, inbuf);
break;
default:
strncpy2(outbuf, inbuf, outlen);
}
}
-void conv_anytojis(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_utf8toeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
{
- switch (conv_guess_ja_encoding(inbuf)) {
- case C_EUC_JP:
- conv_euctojis(outbuf, outlen, inbuf);
- break;
- default:
- strncpy2(outbuf, inbuf, outlen);
- break;
+ static iconv_t cd = (iconv_t)-1;
+ static gboolean iconv_ok = TRUE;
+ gchar *tmpstr;
+
+ if (cd == (iconv_t)-1) {
+ if (!iconv_ok) {
+ strncpy2(outbuf, inbuf, outlen);
+ return;
+ }
+ cd = iconv_open(CS_EUC_JP_MS, CS_UTF_8);
+ if (cd == (iconv_t)-1) {
+ cd = iconv_open(CS_EUC_JP, CS_UTF_8);
+ if (cd == (iconv_t)-1) {
+ g_warning("conv_utf8toeuc(): %s\n",
+ g_strerror(errno));
+ iconv_ok = FALSE;
+ strncpy2(outbuf, inbuf, outlen);
+ return;
+ }
+ }
}
+
+ tmpstr = conv_iconv_strdup_with_cd(inbuf, cd);
+ if (tmpstr) {
+ strncpy2(outbuf, tmpstr, outlen);
+ g_free(tmpstr);
+ } else
+ strncpy2(outbuf, inbuf, outlen);
+}
+
+static void conv_utf8tojis(gchar *outbuf, gint outlen, const gchar *inbuf)
+{
+ gchar *eucstr;
+
+ Xalloca(eucstr, outlen, return);
+
+ conv_utf8toeuc(eucstr, outlen, inbuf);
+ conv_euctojis(outbuf, outlen, eucstr);
}
static gchar valid_eucjp_tbl[][96] = {
return TRUE;
}
-void conv_unreadable_eucjp(gchar *str)
+static void conv_unreadable_eucjp(gchar *str)
{
register guchar *p = str;
}
}
-void conv_unreadable_8bit(gchar *str)
+static void conv_unreadable_8bit(gchar *str)
{
register guchar *p = str;
}
}
-void conv_unreadable_latin(gchar *str)
+static void conv_unreadable_latin(gchar *str)
{
register guchar *p = str;
}
}
-void conv_unreadable_utf8(gchar *str)
-{
- register guchar *p = str;
-
- while (*p != '\0') {
- /* convert CR+LF -> LF */
-
- if (*p == '\r' && *(p + 1) == '\n')
- memmove(p, p + 1, strlen(p));
- else if (((*p & 0xff) >= 0x7f)
- || *p == 0xfc)
- *p = SUBST_CHAR;
- p++;
- }
-}
-
-void conv_unreadable_locale(gchar *str)
-{
- switch (conv_get_current_charset()) {
- case C_US_ASCII:
- case C_ISO_8859_1:
- case C_ISO_8859_2:
- case C_ISO_8859_3:
- case C_ISO_8859_4:
- case C_ISO_8859_5:
- case C_ISO_8859_6:
- case C_ISO_8859_7:
- case C_ISO_8859_8:
- case C_ISO_8859_9:
- case C_ISO_8859_10:
- case C_ISO_8859_11:
- case C_ISO_8859_13:
- case C_ISO_8859_14:
- case C_ISO_8859_15:
- conv_unreadable_latin(str);
- break;
- case C_EUC_JP:
- conv_unreadable_eucjp(str);
- break;
- case C_UTF_8:
- conv_unreadable_utf8(str);
- break;
- default:
- break;
- }
-}
-
#define NCV '\0'
void conv_mb_alnum(gchar *str)
return guessed;
}
-void conv_jistodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_jistodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
{
- conv_jistoeuc(outbuf, outlen, inbuf);
- conv_unreadable_eucjp(outbuf);
+ conv_jistoutf8(outbuf, outlen, inbuf);
}
-void conv_sjistodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_sjistodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
{
- conv_sjistoeuc(outbuf, outlen, inbuf);
- conv_unreadable_eucjp(outbuf);
+ conv_sjistoutf8(outbuf, outlen, inbuf);
}
-void conv_euctodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_euctodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
{
- strncpy2(outbuf, inbuf, outlen);
- conv_unreadable_eucjp(outbuf);
+ conv_euctoutf8(outbuf, outlen, inbuf);
}
-void conv_anytodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
+void conv_utf8todisp(gchar *outbuf, gint outlen, const gchar *inbuf)
{
- conv_anytoutf8(outbuf, outlen, inbuf);
+ strncpy2(outbuf, inbuf, outlen);
}
-#warning FIXME_GTK2
-void conv_ustodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_anytodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
{
- strncpy2(outbuf, inbuf, outlen);
- conv_unreadable_8bit(outbuf);
+ conv_anytoutf8(outbuf, outlen, inbuf);
}
-#warning FIXME_GTK2
-void conv_latintodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_ustodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
{
strncpy2(outbuf, inbuf, outlen);
- conv_unreadable_latin(outbuf);
+ conv_unreadable_8bit(outbuf);
}
-#warning FIXME_GTK2
void conv_localetodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
{
- strncpy2(outbuf, inbuf, outlen);
- conv_unreadable_locale(outbuf);
+ gchar *tmpstr;
+
+ tmpstr = conv_iconv_strdup(inbuf, conv_get_locale_charset_str(),
+ CS_INTERNAL);
+ if (tmpstr) {
+ strncpy2(outbuf, tmpstr, outlen);
+ g_free(tmpstr);
+ } else
+ strncpy2(outbuf, inbuf, outlen);
}
-void conv_noconv(gchar *outbuf, gint outlen, const gchar *inbuf)
+static void conv_noconv(gchar *outbuf, gint outlen, const gchar *inbuf)
{
strncpy2(outbuf, inbuf, outlen);
}
-CodeConverter *conv_code_converter_new(const gchar *charset)
+CodeConverter *conv_code_converter_new(const gchar *src_charset)
{
CodeConverter *conv;
conv = g_new0(CodeConverter, 1);
- conv->code_conv_func = conv_get_code_conv_func(charset, CS_UTF_8);
- conv->charset_str = g_strdup(charset);
- conv->charset = conv_get_charset_from_str(charset);
+ conv->code_conv_func = conv_get_code_conv_func(src_charset, NULL);
+ conv->charset_str = g_strdup(src_charset);
+ conv->charset = conv_get_charset_from_str(src_charset);
return conv;
}
else {
gchar *str;
- str = conv_iconv_strdup(inbuf, conv->charset_str, CS_UTF_8);
+ str = conv_iconv_strdup(inbuf, conv->charset_str, NULL);
if (!str)
return -1;
else {
CharSet dest_charset;
if (!src_charset_str)
- src_charset = conv_get_current_charset();
+ src_charset = conv_get_locale_charset();
else
src_charset = conv_get_charset_from_str(src_charset_str);
if (dest_charset == C_US_ASCII)
return conv_ustodisp;
- else if (dest_charset == C_UTF_8 ||
- (dest_charset == C_AUTO &&
- conv_get_current_charset() == C_UTF_8))
- return conv_noconv;
switch (src_charset) {
- case C_ISO_2022_JP:
- case C_ISO_2022_JP_2:
- case C_ISO_2022_JP_3:
- if (dest_charset == C_AUTO &&
- conv_get_current_charset() == C_EUC_JP)
- code_conv = conv_jistodisp;
- else if (dest_charset == C_EUC_JP)
- code_conv = conv_jistoeuc;
- break;
case C_US_ASCII:
- if (dest_charset == C_AUTO)
- code_conv = conv_ustodisp;
- break;
case C_ISO_8859_1:
case C_ISO_8859_2:
case C_ISO_8859_3:
case C_ISO_8859_13:
case C_ISO_8859_14:
case C_ISO_8859_15:
- if (dest_charset == C_AUTO &&
- (conv_get_current_charset() == src_charset ||
- MB_CUR_MAX > 1))
- code_conv = conv_latintodisp;
+ break;
+ case C_ISO_2022_JP:
+ case C_ISO_2022_JP_2:
+ case C_ISO_2022_JP_3:
+ if (dest_charset == C_AUTO)
+ code_conv = conv_jistodisp;
+ else if (dest_charset == C_EUC_JP)
+ code_conv = conv_jistoeuc;
+ else if (dest_charset == C_UTF_8)
+ code_conv = conv_jistoutf8;
break;
case C_SHIFT_JIS:
- if (dest_charset == C_AUTO &&
- conv_get_current_charset() == C_EUC_JP)
+ if (dest_charset == C_AUTO)
code_conv = conv_sjistodisp;
else if (dest_charset == C_EUC_JP)
code_conv = conv_sjistoeuc;
+ else if (dest_charset == C_UTF_8)
+ code_conv = conv_sjistoutf8;
break;
case C_EUC_JP:
- if (dest_charset == C_AUTO &&
- conv_get_current_charset() == C_EUC_JP)
+ if (dest_charset == C_AUTO)
code_conv = conv_euctodisp;
else if (dest_charset == C_ISO_2022_JP ||
dest_charset == C_ISO_2022_JP_2 ||
dest_charset == C_ISO_2022_JP_3)
code_conv = conv_euctojis;
+ else if (dest_charset == C_UTF_8)
+ code_conv = conv_euctoutf8;
+ break;
+ case C_UTF_8:
+ if (dest_charset == C_EUC_JP)
+ code_conv = conv_utf8toeuc;
+ else if (dest_charset == C_ISO_2022_JP ||
+ dest_charset == C_ISO_2022_JP_2 ||
+ dest_charset == C_ISO_2022_JP_3)
+ code_conv = conv_utf8tojis;
break;
default:
break;
}
gchar *conv_iconv_strdup(const gchar *inbuf,
- const gchar *isrc_code, const gchar *idest_code)
+ const gchar *src_code, const gchar *dest_code)
{
- /* presumably GLib 2's function handles the conversion details,
- * whether iconv is sitting below, or something else */
+ iconv_t cd;
gchar *outbuf;
- gsize read_len, written_len;
- gchar *src_code = (char *)conv_get_outgoing_charset_str();
- gchar *dest_code = (char *)conv_get_current_charset_str();
-
- if (isrc_code)
- src_code = (char *)isrc_code;
- if (idest_code)
- dest_code = (char *)idest_code;
- /* don't convert if current codeset is US-ASCII */
- if (!g_ascii_strcasecmp(dest_code, CS_US_ASCII))
- return g_strdup(inbuf);
+ if (!src_code)
+ src_code = conv_get_outgoing_charset_str();
+ if (!dest_code)
+ dest_code = CS_INTERNAL;
/* don't convert if src and dest codeset are identical */
- if (!g_ascii_strcasecmp(src_code, dest_code))
+ if (!strcasecmp(src_code, dest_code))
+ return g_strdup(inbuf);
+
+ /* don't convert if current codeset is US-ASCII */
+ if (!strcasecmp(dest_code, CS_US_ASCII))
return g_strdup(inbuf);
- /* FIXME: unchecked inbuf? Can't see at this level. */
- outbuf = g_convert(inbuf, strlen(inbuf), dest_code, src_code,
- &read_len, &written_len, NULL);
+ cd = iconv_open(dest_code, src_code);
+ if (cd == (iconv_t)-1)
+ return NULL;
+
+ outbuf = conv_iconv_strdup_with_cd(inbuf, cd);
+
+ iconv_close(cd);
+
+ return outbuf;
+}
+
+gchar *conv_iconv_strdup_with_cd(const gchar *inbuf, iconv_t cd)
+{
+ const gchar *inbuf_p;
+ gchar *outbuf;
+ gchar *outbuf_p;
+ size_t in_size;
+ size_t in_left;
+ size_t out_size;
+ size_t out_left;
+ size_t n_conv;
+ size_t len;
- if (outbuf == NULL)
- g_warning(_("Valid locale type set? (Currently: %s to %s)\n"),
- src_code, dest_code);
-
- return outbuf;
+ inbuf_p = inbuf;
+ in_size = strlen(inbuf);
+ in_left = in_size;
+ out_size = (in_size + 1) * 2;
+ outbuf = g_malloc(out_size);
+ outbuf_p = outbuf;
+ out_left = out_size;
+
+#define EXPAND_BUF() \
+{ \
+ len = outbuf_p - outbuf; \
+ out_size *= 2; \
+ outbuf = g_realloc(outbuf, out_size); \
+ outbuf_p = outbuf + len; \
+ out_left = out_size - len; \
+}
+
+ while ((n_conv = iconv(cd, (ICONV_CONST gchar **)&inbuf_p, &in_left,
+ &outbuf_p, &out_left)) == (size_t)-1) {
+ if (EILSEQ == errno) {
+ //g_print("iconv(): at %d: %s\n", in_size - in_left, g_strerror(errno));
+ inbuf_p++;
+ in_left--;
+ if (out_left == 0) {
+ EXPAND_BUF();
+ }
+ *outbuf_p++ = SUBST_CHAR;
+ out_left--;
+ } else if (EINVAL == errno) {
+ break;
+ } else if (E2BIG == errno) {
+ EXPAND_BUF();
+ } else {
+ g_warning("conv_iconv_strdup(): %s\n",
+ g_strerror(errno));
+ break;
+ }
+ }
+
+ while ((n_conv = iconv(cd, NULL, NULL, &outbuf_p, &out_left)) ==
+ (size_t)-1) {
+ if (E2BIG == errno) {
+ EXPAND_BUF();
+ } else {
+ g_warning("conv_iconv_strdup(): %s\n",
+ g_strerror(errno));
+ break;
+ }
+ }
+
+#undef EXPAND_BUF
+
+ len = outbuf_p - outbuf;
+ outbuf = g_realloc(outbuf, len + 1);
+ outbuf[len] = '\0';
+
+ return outbuf;
}
static const struct {
{C_ISO_2022_JP_3, CS_ISO_2022_JP_3},
{C_EUC_JP, CS_EUC_JP},
{C_EUC_JP, CS_EUCJP},
+ {C_EUC_JP_MS, CS_EUC_JP_MS},
{C_SHIFT_JIS, CS_SHIFT_JIS},
{C_SHIFT_JIS, CS_SHIFT__JIS},
{C_SHIFT_JIS, CS_SJIS},
return GPOINTER_TO_UINT(g_hash_table_lookup(table, charset));
}
-CharSet conv_get_current_charset(void)
+CharSet conv_get_locale_charset(void)
{
static CharSet cur_charset = -1;
const gchar *cur_locale;
return cur_charset;
}
-const gchar *conv_get_current_charset_str(void)
+const gchar *conv_get_locale_charset_str(void)
{
static const gchar *codeset = NULL;
if (!codeset)
- codeset = conv_get_charset_str(conv_get_current_charset());
+ codeset = conv_get_charset_str(conv_get_locale_charset());
+
+ return codeset ? codeset : CS_INTERNAL;
+}
- return codeset ? codeset : CS_US_ASCII;
+CharSet conv_get_internal_charset(void)
+{
+ return C_INTERNAL;
+}
+
+const gchar *conv_get_internal_charset_str(void)
+{
+ return CS_INTERNAL;
}
CharSet conv_get_outgoing_charset(void)
out_charset = conv_get_outgoing_charset();
str = conv_get_charset_str(out_charset);
- return str ? str : CS_US_ASCII;
+ return str ? str : CS_UTF_8;
}
gboolean conv_is_multibyte_encoding(CharSet encoding)
{
switch (encoding) {
case C_EUC_JP:
+ case C_EUC_JP_MS:
case C_EUC_KR:
case C_EUC_TW:
case C_EUC_CN:
const gchar *conv_get_current_locale(void)
{
- static const gchar *cur_locale = NULL;
+ const gchar *cur_locale;
- if (cur_locale != NULL)
- return cur_locale;
-
cur_locale = g_getenv("LC_ALL");
- if (!cur_locale || !strlen(cur_locale))
- cur_locale = g_getenv("LC_CTYPE");
- if (!cur_locale || !strlen(cur_locale))
- cur_locale = g_getenv("LANG");
- if (!cur_locale || !strlen(cur_locale))
- cur_locale = setlocale(LC_CTYPE, NULL);
-
- if (cur_locale && strlen(cur_locale)) {
- gchar *tmp = g_strdup(cur_locale);
- cur_locale = g_strdup(tmp);
- g_free(tmp);
- }
+ if (!cur_locale) cur_locale = g_getenv("LC_CTYPE");
+ if (!cur_locale) cur_locale = g_getenv("LANG");
+ if (!cur_locale) cur_locale = setlocale(LC_CTYPE, NULL);
+
+ debug_print("current locale: %s\n",
+ cur_locale ? cur_locale : "(none)");
return cur_locale;
}
gchar *buf;
gint buflen;
CharSet cur_charset;
- const gchar *locale;
- g_return_if_fail(str != NULL);
-
- cur_charset = conv_get_current_charset();
+ cur_charset = conv_get_locale_charset();
-#warning FIXME_GTK2
-/* Should we always ensure to convert? */
- locale = conv_get_current_locale();
-
- if (locale && !strncasecmp(locale, "ja", 2)) {
+ if (cur_charset == C_EUC_JP) {
buflen = strlen(str) * 2 + 1;
Xalloca(buf, buflen, return);
conv_anytodisp(buf, buflen, str);
void conv_unmime_header(gchar *outbuf, gint outlen, const gchar *str,
const gchar *charset)
{
- const gchar *locale;
+ CharSet cur_charset;
- memset(outbuf, 0, outlen);
-
- locale = conv_get_current_locale();
+ cur_charset = conv_get_locale_charset();
- if (locale && !strncasecmp(locale, "ja", 2)) {
+ if (cur_charset == C_EUC_JP) {
gchar *buf;
gint buflen;
Xalloca(buf, buflen, return);
conv_anytodisp(buf, buflen, str);
unmime_header(outbuf, buf);
- } else {
- gchar *tmp = NULL;
+ } else
unmime_header(outbuf, str);
- if (outbuf && !g_utf8_validate(outbuf, -1, NULL)) {
- if (strcmp(conv_get_current_charset_str(), CS_UTF_8))
- tmp = conv_codeset_strdup(outbuf,
- conv_get_current_charset_str(),
- CS_UTF_8);
-
- if (tmp) {
- strncpy(outbuf, tmp, outlen-1);
- g_free(tmp);
- } else {
- conv_localetodisp(outbuf, outlen, str);
- }
- }
- }
}
#define MAX_LINELEN 76
const guchar *srcp = src;
guchar *destp = dest;
gboolean use_base64;
- gchar *testbuf;
-
+
+ g_return_if_fail(g_utf8_validate(src, -1, NULL) == TRUE);
+
if (MB_CUR_MAX > 1) {
use_base64 = TRUE;
mimesep_enc = "?B?";
mimesep_enc = "?Q?";
}
- cur_encoding = CS_UTF_8; /* gtk2 */
-
+ cur_encoding = CS_INTERNAL;
out_encoding = conv_get_outgoing_charset_str();
if (!strcmp(out_encoding, CS_US_ASCII))
out_encoding = CS_ISO_8859_1;
- testbuf = conv_codeset_strdup(src, cur_encoding, out_encoding);
-
- if (testbuf != NULL)
- g_free(testbuf);
- else
- out_encoding = CS_UTF_8;
-
mimestr_len = strlen(MIMESEP_BEGIN) + strlen(out_encoding) +
strlen(mimesep_enc) + strlen(MIMESEP_END);
if (addr_field && (*p == '(' || *p == ')'))
break;
- if (MB_CUR_MAX > 1) {
- mb_len = mblen(p, MB_CUR_MAX);
- if (mb_len < 0) {
- g_warning("conv_encode_header(): invalid multibyte character encountered\n");
- mb_len = 1;
- }
- } else
- mb_len = 1;
+ mb_len = g_utf8_skip[*p];
Xstrndup_a(part_str, srcp, cur_len + mb_len, );
out_str = conv_codeset_strdup
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2004 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#endif
#include <glib.h>
+#include <iconv.h>
typedef struct _CodeConverter CodeConverter;
C_ISO_2022_JP_2,
C_ISO_2022_JP_3,
C_EUC_JP,
+ C_EUC_JP_MS,
C_SHIFT_JIS,
C_ISO_2022_KR,
C_EUC_KR,
#define CS_ISO_2022_JP_3 "ISO-2022-JP-3"
#define CS_EUC_JP "EUC-JP"
#define CS_EUCJP "EUCJP"
+#define CS_EUC_JP_MS "EUC-JP-MS"
#define CS_SHIFT_JIS "Shift_JIS"
#define CS_SHIFT__JIS "SHIFT-JIS"
#define CS_SJIS "SJIS"
#define CS_GEORGIAN_PS "GEORGIAN-PS"
#define CS_TCVN5712_1 "TCVN5712-1"
-void conv_jistoeuc (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_euctojis (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_sjistoeuc (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_anytoeuc (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_anytoutf8 (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_anytojis (gchar *outbuf, gint outlen, const gchar *inbuf);
+#define C_INTERNAL C_UTF_8
+#define CS_INTERNAL CS_UTF_8
-void conv_unreadable_eucjp (gchar *str);
-void conv_unreadable_8bit (gchar *str);
-void conv_unreadable_latin (gchar *str);
-void conv_unreadable_locale (gchar *str);
-
-void conv_mb_alnum(gchar *str);
+//void conv_mb_alnum(gchar *str);
CharSet conv_guess_ja_encoding(const gchar *str);
-void conv_jistodisp (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_sjistodisp (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_euctodisp (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_ustodisp (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_latintodisp (gchar *outbuf, gint outlen, const gchar *inbuf);
-void conv_noconv (gchar *outbuf, gint outlen, const gchar *inbuf);
+void conv_utf8todisp (gchar *outbuf, gint outlen, const gchar *inbuf);
void conv_localetodisp (gchar *outbuf, gint outlen, const gchar *inbuf);
-CodeConverter *conv_code_converter_new (const gchar *charset);
+CodeConverter *conv_code_converter_new (const gchar *src_charset);
void conv_code_converter_destroy (CodeConverter *conv);
gint conv_convert (CodeConverter *conv,
gchar *outbuf,
gchar *conv_iconv_strdup (const gchar *inbuf,
const gchar *src_code,
const gchar *dest_code);
+gchar *conv_iconv_strdup_with_cd (const gchar *inbuf,
+ iconv_t cd);
const gchar *conv_get_charset_str (CharSet charset);
CharSet conv_get_charset_from_str (const gchar *charset);
-CharSet conv_get_current_charset (void);
-const gchar *conv_get_current_charset_str (void);
+CharSet conv_get_locale_charset (void);
+const gchar *conv_get_locale_charset_str (void);
+CharSet conv_get_internal_charset (void);
+const gchar *conv_get_internal_charset_str (void);
CharSet conv_get_outgoing_charset (void);
const gchar *conv_get_outgoing_charset_str (void);
gboolean conv_is_multibyte_encoding (CharSet encoding);
FILE *fp;
gchar buf[BUFFSIZE];
gint bytes_read;
-#warning FIXME_GTK2
- const gchar *src_codeset = conv_get_current_charset_str();
- const gchar *dest_codeset = CS_UTF_8;
if ((fp = fopen(filename, "rb")) == NULL) {
FILE_OP_ERROR(filename, "fopen");
if (buf[0] == '\n')
break;
- else if (!g_ascii_strncasecmp(buf, "Name:", 5)) {
- tmp = conv_codeset_strdup(buf + 5,
- src_codeset,
- dest_codeset);
- tmpl->name = tmp ? g_strstrip(tmp) : g_strdup(buf + 5);
- } else if (!g_ascii_strncasecmp(buf, "Subject:", 8)) {
- tmp = conv_codeset_strdup(buf + 8,
- src_codeset,
- dest_codeset);
- tmpl->subject = tmp ? g_strstrip(tmp) : g_strdup(buf + 8);
- } else if (!g_ascii_strncasecmp(buf, "To:", 3)) {
- tmp = conv_codeset_strdup(buf + 3,
- src_codeset,
- dest_codeset);
- tmpl->to = tmp ? g_strstrip(tmp) : g_strdup(buf + 3);
- } else if (!g_ascii_strncasecmp(buf, "Cc:", 3)) {
- tmp = conv_codeset_strdup(buf + 3,
- src_codeset,
- dest_codeset);
- tmpl->cc = tmp ? g_strstrip(tmp) : g_strdup(buf + 3);
- } else if (!g_ascii_strncasecmp(buf, "Bcc:", 4)) {
- tmp = conv_codeset_strdup(buf + 4,
- src_codeset,
- dest_codeset);
- tmpl->bcc = tmp ? g_strstrip(tmp) : g_strdup(buf + 4);
- }
+ else if (!g_ascii_strncasecmp(buf, "Name:", 5))
+ tmpl->name = g_strdup(g_strstrip(buf + 5));
+ else if (!g_ascii_strncasecmp(buf, "To:", 3))
+ tmpl->to = g_strdup(g_strstrip(buf + 3));
+ else if (!g_ascii_strncasecmp(buf, "Cc:", 3))
+ tmpl->cc = g_strdup(g_strstrip(buf + 3));
+ else if (!g_ascii_strncasecmp(buf, "Subject:", 8))
+ tmpl->subject = g_strdup(g_strstrip(buf + 8));
}
if (!tmpl->name) {
}
}
fclose(fp);
- buf[bytes_read] = '\0';
- tmpl->value = conv_codeset_strdup(buf, src_codeset, dest_codeset);
- if (!tmpl->value)
- tmpl->value = g_strdup(buf);
+ tmpl->value = g_strndup(buf, bytes_read);
return tmpl;
}
while ((de = readdir(dp)) != NULL) {
if (*de->d_name == '.') continue;
- filename = g_strconcat(path, G_DIR_SEPARATOR_S, de->d_name, NULL);
+ filename = g_strconcat(path, G_DIR_SEPARATOR_S,
+ de->d_name, NULL);
if (stat(filename, &s) != 0 || !S_ISREG(s.st_mode) ) {
debug_print("%s:%d %s is not an ordinary file\n",
tmpl = template_load(filename);
if (tmpl)
tmpl_list = g_slist_append(tmpl_list, tmpl);
+
g_free(filename);
}
for (cur = tmpl_list, tmpl_num = 1; cur != NULL;
cur = cur->next, tmpl_num++) {
-#warning FIXME_GTK2
- const gchar *src_codeset = CS_UTF_8;
- const gchar *dest_codeset = conv_get_current_charset_str();
- gchar *tmp = NULL;
gchar *filename;
tmpl = cur->data;
return;
}
- tmp = conv_codeset_strdup(tmpl->name, src_codeset, dest_codeset);
- if (!tmp)
- tmp = g_strdup(tmpl->name);
- fprintf(fp, "Name: %s\n", tmp ? tmp : "");
- g_free(tmp);
-
- if (tmpl->subject && *tmpl->subject != '\0') {
- tmp = conv_codeset_strdup(tmpl->subject,
- src_codeset, dest_codeset);
- if (!tmp)
- tmp = g_strdup(tmpl->subject);
- fprintf(fp, "Subject: %s\n", tmp);
- g_free(tmp);
- }
-
- if (tmpl->to && *tmpl->to != '\0') {
- tmp = conv_codeset_strdup(tmpl->to,
- src_codeset, dest_codeset);
- if (!tmp)
- tmp = g_strdup(tmpl->to);
- fprintf(fp, "To: %s\n", tmp);
- g_free(tmp);
- }
-
- if (tmpl->cc && *tmpl->cc != '\0') {
- tmp = conv_codeset_strdup(tmpl->cc,
- src_codeset, dest_codeset);
- if (!tmp)
- tmp = g_strdup(tmpl->cc);
- fprintf(fp, "Cc: %s\n", tmp);
- g_free(tmp);
- }
-
- if (tmpl->bcc && *tmpl->bcc != '\0') {
- tmp = conv_codeset_strdup(tmpl->bcc,
- src_codeset, dest_codeset);
- if (!tmp)
- tmp = g_strdup(tmpl->bcc);
- fprintf(fp, "Bcc: %s\n", tmp);
- g_free(tmp);
- }
-
+ fprintf(fp, "Name: %s\n", tmpl->name);
+ if (tmpl->subject && *tmpl->subject != '\0')
+ fprintf(fp, "Subject: %s\n", tmpl->subject);
+ if (tmpl->to && *tmpl->to != '\0')
+ fprintf(fp, "To: %s\n", tmpl->to);
+ if (tmpl->cc && *tmpl->cc != '\0')
+ fprintf(fp, "Cc: %s\n", tmpl->cc);
+ if (tmpl->cc && *tmpl->bcc != '\0')
+ fprintf(fp, "Cc: %s\n", tmpl->bcc);
fputs("\n", fp);
- tmp = conv_codeset_strdup(tmpl->value,
- src_codeset, dest_codeset);
- if (!tmp)
- tmp = g_strdup(tmpl->value);
- fwrite(tmp, sizeof(gchar) * strlen(tmp), 1, fp);
- g_free(tmp);
+ fwrite(tmpl->value, sizeof(gchar) * strlen(tmpl->value), 1, fp);
+
fclose(fp);
g_free(filename);
}
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2004 Hiroyuki Yamamoto & The Sylpheed-Claws Team
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto & The Sylpheed-Claws Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return -1;
while (*p != '\0') {
- mb_len = mblen(p, MB_LEN_MAX);
+ mb_len = g_utf8_skip[*(guchar *)p];
if (mb_len == 0)
break;
- else if (mb_len < 0)
- return -1;
else
len++;
if (!str) return NULL;
if (strlen(str) <= len)
return g_strdup(str);
+ if (g_utf8_validate(str, -1, NULL) == FALSE)
+ return g_strdup(str);
while (*p != '\0') {
- mb_len = mblen(p, MB_LEN_MAX);
+ mb_len = g_utf8_skip[*(guchar *)p];
if (mb_len == 0)
break;
- else if (mb_len < 0)
- return g_strdup(str);
else if (new_len + mb_len > len)
break;
- else
- new_len += mb_len;
+
+ new_len += mb_len;
p += mb_len;
}
= conv_codeset_strdup(
file + 5,
CS_UTF_8,
- conv_get_current_charset_str());
+ conv_get_locale_charset_str());
if (!locale_file)
locale_file = g_strdup(file + 5);
result = g_list_append(result, locale_file);
if (!g_utf8_validate(str, -1, NULL)) {
const gchar *src_codeset, *dest_codeset;
gchar *tmp = NULL;
- src_codeset = conv_get_current_charset_str();
+ src_codeset = conv_get_locale_charset_str();
dest_codeset = CS_UTF_8;
tmp = conv_codeset_strdup(str, src_codeset, dest_codeset);
g_free(str);
if (!g_utf8_validate(ret, -1, NULL)) {
const gchar *src_codeset, *dest_codeset;
gchar *tmp = NULL;
- src_codeset = conv_get_current_charset_str();
+ src_codeset = conv_get_locale_charset_str();
dest_codeset = CS_UTF_8;
tmp = conv_codeset_strdup(ret, src_codeset, dest_codeset);
g_free(ret);
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
newfile->bufp = newfile->buf->str;
newfile->dtd = NULL;
+ newfile->encoding = NULL;
newfile->tag_stack = NULL;
newfile->level = 0;
newfile->is_empty_element = FALSE;
g_string_free(file->buf, TRUE);
g_free(file->dtd);
+ g_free(file->encoding);
while (file->tag_stack != NULL)
xml_pop_tag(file);
if ((*bufp++ == '?') &&
(bufp = strcasestr(bufp, "xml")) &&
(bufp = strcasestr(bufp + 3, "version")) &&
- (bufp = strchr(bufp + 7, '?')))
+ (bufp = strchr(bufp + 7, '?'))) {
file->dtd = g_strdup(buf);
- else {
+ if ((bufp = strcasestr(buf, "encoding=\""))) {
+ bufp += 9;
+ extract_quote(bufp, '"');
+ file->encoding = g_strdup(bufp);
+ } else
+ file->encoding = g_strdup(CS_INTERNAL);
+ } else {
g_warning("Can't get xml dtd\n");
return -1;
}
{
gchar buf[XMLBUFSIZE];
guchar *bufp = buf;
+ gchar *tag_str;
XMLTag *tag;
gint len;
while (*bufp != '\0' && !isspace(*bufp)) bufp++;
if (*bufp == '\0') {
- tag->tag = XML_STRING_ADD(buf);
+ tag_str = conv_codeset_strdup(buf, file->encoding, CS_INTERNAL);
+ if (tag_str) {
+ tag->tag = XML_STRING_ADD(tag_str);
+ g_free(tag_str);
+ } else
+ tag->tag = XML_STRING_ADD(buf);
return 0;
} else {
*bufp++ = '\0';
- tag->tag = XML_STRING_ADD(buf);
+ tag_str = conv_codeset_strdup(buf, file->encoding, CS_INTERNAL);
+ if (tag_str) {
+ tag->tag = XML_STRING_ADD(tag_str);
+ g_free(tag_str);
+ } else
+ tag->tag = XML_STRING_ADD(buf);
}
/* parse attributes ( name=value ) */
while (*bufp) {
XMLAttr *attr;
- gchar *attr_name, *attr_value;
- gchar *utf8attr_name, *utf8attr_value;
+ gchar *attr_name;
+ gchar *attr_value;
+ gchar *utf8_attr_name;
+ gchar *utf8_attr_value;
gchar *p;
gchar quote;
g_strchomp(attr_name);
xml_unescape_str(attr_value);
-
- if (!g_utf8_validate(attr_name, -1, NULL))
- utf8attr_name = conv_codeset_strdup
- (attr_name,
- conv_get_current_charset_str(),
- CS_UTF_8);
- else
- utf8attr_name = g_strdup(attr_name);
-
- if (!g_utf8_validate(attr_value, -1, NULL))
- utf8attr_value = conv_codeset_strdup
- (attr_value,
- conv_get_current_charset_str(),
- CS_UTF_8);
- else
- utf8attr_value = g_strdup(attr_value);
-
- attr = xml_attr_new(utf8attr_name, utf8attr_value);
+ utf8_attr_name = conv_codeset_strdup
+ (attr_name, file->encoding, CS_INTERNAL);
+ utf8_attr_value = conv_codeset_strdup
+ (attr_value, file->encoding, CS_INTERNAL);
+ if (!utf8_attr_name)
+ utf8_attr_name = g_strdup(attr_name);
+ if (!utf8_attr_value)
+ utf8_attr_value = g_strdup(attr_value);
+
+ attr = xml_attr_new(utf8_attr_name, utf8_attr_value);
xml_tag_add_attr(tag, attr);
- g_free(utf8attr_name);
- g_free(utf8attr_value);
+ g_free(utf8_attr_value);
+ g_free(utf8_attr_name);
}
return 0;
gchar *xml_get_element(XMLFile *file)
{
gchar *str;
+ gchar *new_str;
gchar *end;
- gchar *utf8str;
while ((end = strchr(file->bufp, '<')) == NULL)
if (xml_read_line(file) < 0) return NULL;
return NULL;
}
- utf8str = conv_codeset_strdup
- (str,
- conv_get_current_charset_str(),
- CS_UTF_8);
- if (!utf8str) {
- g_warning("xml_get_element(): "
- "faild to convert character set.\n");
- utf8str = str;
- } else
- g_free(str);
+ new_str = conv_codeset_strdup(str, file->encoding, CS_INTERNAL);
+ if (!new_str)
+ new_str = g_strdup(str);
+ g_free(str);
- return utf8str;
+ return new_str;
}
gint xml_read_line(XMLFile *file)
gint xml_file_put_escape_str(FILE *fp, const gchar *str)
{
const gchar *src_codeset = CS_UTF_8;
- const gchar *dest_codeset = conv_get_current_charset_str();
+ const gchar *dest_codeset = conv_get_locale_charset_str();
gchar *tmpstr = NULL;
const gchar *p;
{
g_return_val_if_fail(fp != NULL, -1);
- fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\"?>\n",
- conv_get_current_charset_str());
+ fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", CS_INTERNAL);
return 0;
}
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
gchar *bufp;
gchar *dtd;
+ gchar *encoding;
+
GList *tag_stack;
guint level;
GtkTextBuffer *buffer;
GtkTextMark *mark;
GtkTextIter iter;
+ const gchar *cur_encoding;
gchar buf[BUFFSIZE];
gint len;
FILE *fp;
G_CALLBACK(text_inserted),
compose);
+ cur_encoding = conv_get_locale_charset_str();
+
while (fgets(buf, sizeof(buf), fp) != NULL) {
- const gchar *cur_encoding = conv_get_current_charset_str();
- gchar *str = NULL;
- if (!g_utf8_validate(buf, -1, NULL))
- str = conv_codeset_strdup(buf, cur_encoding, CS_UTF_8);
- else
- str = g_strdup(buf);
+ gchar *str;
+ str = conv_codeset_strdup(buf, cur_encoding, CS_INTERNAL);
if (!str) continue;
/* strip <CR> if DOS/Windows file,
while (--len >= 0)
if (str[len] == '\r') str[len] = '\n';
}
- gtk_text_buffer_insert(buffer, &iter, str, -1);
- g_free (str);
+ gtk_text_buffer_insert(buffer, &iter, str, -1);
+ g_free(str);
}
g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
}
#define DISP_WIDTH(len) \
- ((len > 2 && conv_get_current_charset() == C_UTF_8) ? 2 : \
- (len == 2 && conv_get_current_charset() == C_UTF_8) ? 1 : len)
+ ((len > 2 && conv_get_locale_charset() == C_UTF_8) ? 2 : \
+ (len == 2 && conv_get_locale_charset() == C_UTF_8) ? 1 : len)
#define SPACE_CHARS " \t"
else
encoding = procmime_get_encoding_for_charset(out_codeset);
- src_codeset = CS_UTF_8;
+ src_codeset = CS_INTERNAL;
/* if current encoding is US-ASCII, set it the same as
outgoing one to prevent code conversion failure */
if (!g_ascii_strcasecmp(src_codeset, CS_US_ASCII))
gtk_text_buffer_get_end_iter(buffer, &end);
tmp = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
- src_codeset = CS_UTF_8;
- dest_codeset = conv_get_current_charset_str();
- chars = conv_codeset_strdup(tmp, src_codeset, dest_codeset);
+ chars = conv_codeset_strdup
+ (tmp, CS_INTERNAL, conv_get_locale_charset_str());
+
g_free(tmp);
if (!chars) return -1;
strcmp(prefs_common.dictionary, _("None"))) {
gtkaspell = gtkaspell_new(prefs_common.aspell_path,
prefs_common.dictionary,
- conv_get_current_charset_str(),
+ conv_get_locale_charset_str(),
prefs_common.misspelled_col,
prefs_common.check_while_typing,
prefs_common.use_alternate,
utf8mbox = gtk_entry_get_text(GTK_ENTRY(file_entry));
if (utf8mbox && *utf8mbox) {
const gchar *src_codeset = CS_UTF_8;
- const gchar *dest_codeset = conv_get_current_charset_str();
+ const gchar *dest_codeset = conv_get_locale_charset_str();
gchar *mbox;
#warning FIXME_GTK2 /* should we use g_filename_from_utf8()? */
if (g_getenv ("G_BROKEN_FILENAMES")) {
const gchar *oldstr = filename;
filename = conv_codeset_strdup (filename,
- conv_get_current_charset_str(),
+ conv_get_locale_charset_str(),
CS_UTF_8);
if (!filename) {
g_warning("export_filesel_cb(): faild to convert character set.");
void folder_item_prefs_read_config(FolderItem * item)
{
gchar * id;
+ gchar *rcpath;
id = folder_item_get_identifier(item);
folder_item_prefs_clear(&tmp_prefs);
- prefs_read_config(param, id, FOLDERITEM_RC);
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, FOLDERITEM_RC, NULL);
+ prefs_read_config(param, id, rcpath, NULL);
g_free(id);
+ g_free(rcpath);
*item->prefs = tmp_prefs;
}
utf8buf = conv_codeset_strdup((unsigned char*)l->data,
- conv_get_current_charset_str(),
+ conv_get_locale_charset_str(),
CS_UTF_8);
item = gtk_menu_item_new_with_label(utf8buf);
gtk_widget_show(item);
conv->charset == C_ISO_2022_JP_2 ||
conv->charset == C_EUC_JP ||
conv->charset == C_SHIFT_JIS) &&
- conv_get_current_charset() == C_EUC_JP)
+ conv_get_locale_charset() == C_EUC_JP)
parser->symbol_table = eucjp_symbol_table;
else
parser->symbol_table = default_symbol_table;
if (conv_convert(parser->conv, buf2, sizeof(buf2), buf) < 0) {
index = parser->bufp - parser->buf->str;
- conv_localetodisp(buf2, sizeof(buf2), buf);
+ conv_utf8todisp(buf2, sizeof(buf2), buf);
g_string_append(parser->buf, buf2);
parser->bufp = parser->buf->str + index;
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2004 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static gchar *imap_modified_utf7_to_utf8(const gchar *mutf7_str)
{
-#if !HAVE_ICONV
- const gchar *from_p;
- gchar *to, *to_p;
-
- to = g_malloc(strlen(mutf7_str) + 1);
- to_p = to;
-
- for (from_p = mutf7_str; *from_p != '\0'; from_p++) {
- if (*from_p == '&' && *(from_p + 1) == '-') {
- *to_p++ = '&';
- from_p++;
- } else
- *to_p++ = *from_p;
- }
- *to_p = '\0';
-
- return to;
-#else
static iconv_t cd = (iconv_t)-1;
static gboolean iconv_ok = TRUE;
GString *norm_utf7;
if (!iconv_ok) return g_strdup(mutf7_str);
if (cd == (iconv_t)-1) {
- cd = iconv_open(conv_get_current_charset_str(), CS_UTF_8);
+ cd = iconv_open(CS_INTERNAL, CS_UTF_7);
if (cd == (iconv_t)-1) {
- g_warning(_("iconv cannot convert UTF-7 to UTF-8\n"));
+ g_warning("iconv cannot convert UTF-7 to %s\n",
+ CS_INTERNAL);
iconv_ok = FALSE;
return g_strdup(mutf7_str);
}
}
+ /* modified UTF-7 to normal UTF-7 conversion */
norm_utf7 = g_string_new(NULL);
for (p = mutf7_str; *p != '\0'; p++) {
if (iconv(cd, (ICONV_CONST gchar **)&norm_utf7_p, &norm_utf7_len,
&to_p, &to_len) == -1) {
- g_warning(_("iconv cannot convert UTF-7 to UTF-8\n"));
+ g_warning(_("iconv cannot convert UTF-7 to %s\n"),
+ conv_get_locale_charset_str());
g_string_free(norm_utf7, TRUE);
g_free(to_str);
return g_strdup(mutf7_str);
*to_p = '\0';
return to_str;
-#endif /* !HAVE_ICONV */
}
static gchar *imap_utf8_to_modified_utf7(const gchar *from)
{
-#if !HAVE_ICONV
- const gchar *from_p;
- gchar *to, *to_p;
-
- to = g_malloc(strlen(from) * 2 + 1);
- to_p = to;
-
- for (from_p = from; *from_p != '\0'; from_p++) {
- if (*from_p == '&') {
- *to_p++ = '&';
- *to_p++ = '-';
- } else
- *to_p++ = *from_p;
- }
- *to_p = '\0';
-
- return to;
-#else
static iconv_t cd = (iconv_t)-1;
static gboolean iconv_ok = TRUE;
gchar *norm_utf7, *norm_utf7_p;
if (!iconv_ok) return g_strdup(from);
if (cd == (iconv_t)-1) {
- cd = iconv_open("UTF-7", CS_UTF_8);
+ cd = iconv_open(CS_UTF_7, CS_INTERNAL);
if (cd == (iconv_t)-1) {
- g_warning("iconv cannot convert UTF-8 to UTF-7\n");
+ g_warning(_("iconv cannot convert %s to UTF-7\n"),
+ CS_INTERNAL);
iconv_ok = FALSE;
return g_strdup(from);
}
}
+ /* UTF-8 to normal UTF-7 conversion */
Xstrdup_a(from_tmp, from, return g_strdup(from));
from_len = strlen(from);
norm_utf7_len = from_len * 5;
from_tmp++;
from_len--;
} else {
- size_t mb_len = 0, conv_len = 0;
+ size_t conv_len = 0;
/* unprintable char: convert to UTF-7 */
p = from_tmp;
while (!IS_PRINT(*(guchar *)p) && conv_len < from_len) {
- mb_len = mblen(p, MB_LEN_MAX);
- if (mb_len <= 0) {
- g_warning("wrong multibyte sequence\n");
- return g_strdup(from);
- }
- conv_len += mb_len;
- p += mb_len;
+ conv_len += g_utf8_skip[*(guchar *)p];
+ p += g_utf8_skip[*(guchar *)p];
}
from_len -= conv_len;
g_string_free(to_str, FALSE);
return to;
-#endif /* !HAVE_ICONV */
}
static GSList *imap_get_seq_set_from_numlist(MsgNumberList *numlist)
utf8filename = gtk_entry_get_text(GTK_ENTRY(file_entry));
destdir = gtk_entry_get_text(GTK_ENTRY(dest_entry));
if (utf8filename && *utf8filename) {
- const gchar *src_codeset = CS_UTF_8;
- const gchar *dest_codeset = conv_get_current_charset_str();
gchar *filename;
-#warning FIXME_GTK2 /* should we use g_filename_from_utf8? */
- filename = conv_codeset_strdup(utf8filename,
- src_codeset,
- dest_codeset);
+ filename = g_filename_from_utf8
+ (utf8filename, -1, NULL, NULL, NULL);
if (!filename) {
g_warning("faild to convert character set\n");
filename = g_strdup(utf8filename);
static void import_filesel_cb(GtkWidget *widget, gpointer data)
{
gchar *filename;
+ gchar *utf8_filename;
filename = filesel_select_file_open(_("Select importing file"), NULL);
if (!filename) return;
- if (g_getenv ("G_BROKEN_FILENAMES")) {
- const gchar *oldstr = filename;
- filename = conv_codeset_strdup (filename,
- conv_get_current_charset_str(),
- CS_UTF_8);
- if (!filename) {
- g_warning("import_filesel_cb(): faild to convert character set.");
- filename = g_strdup(oldstr);
- }
- gtk_entry_set_text(GTK_ENTRY(file_entry), filename);
- g_free(filename);
- } else
- gtk_entry_set_text(GTK_ENTRY(file_entry), filename);
+ utf8_filename = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
+ if (!utf8_filename) {
+ g_warning("import_filesel_cb(): faild to convert characer set.");
+ utf8_filename = g_strdup(filename);
+ }
+ gtk_entry_set_text(GTK_ENTRY(file_entry), utf8_filename);
+ g_free(utf8_filename);
}
static void import_destsel_cb(GtkWidget *widget, gpointer data)
#include "jpilot.h"
#include "codeconv.h"
#include "adbookbase.h"
+#include "utils.h"
#define JPILOT_DBHOME_DIR ".jpilot"
#define JPILOT_DBHOME_FILE "AddressDB.pdb"
email = addritem_create_item_email();
addritem_email_set_address( email, node->data );
if (convert_charcode) {
- conv_sjistoeuc(convertBuff, JPILOT_LEN_LABEL, buffer);
- addritem_email_set_remarks(email, convertBuff);
+ gchar *convertBuff;
+ convertBuff = conv_codeset_strdup( ai->labels[ind], CS_SHIFT_JIS, CS_INTERNAL );
+ addritem_email_set_remarks( email, convertBuff );
+ g_free( convertBuff );
}
else {
addritem_email_set_remarks(email, buffer);
if( convert_charcode ) {
gchar *nameConv;
- nameConv = g_strdup( fullName );
- conv_sjistoeuc( fullName, FULLNAME_BUFSIZE, nameConv );
+ nameConv = conv_codeset_strdup( fullName, CS_SHIFT_JIS, CS_INTERNAL );
+ strncpy2( fullName, nameConv, FULLNAME_BUFSIZE );
g_free( nameConv );
}
/* Add entry for each custom label */
node = pilotFile->labelInd;
while( node ) {
- gchar convertBuff[JPILOT_LEN_LABEL];
gint ind;
ind = GPOINTER_TO_INT( node->data );
gchar convertBuff[ JPILOT_LEN_LABEL ];
if( convert_charcode ) {
- conv_sjistoeuc( convertBuff, JPILOT_LEN_LABEL, labelName );
+ labelName = conv_codeset_strdup( labelName, CS_SHIFT_JIS, CS_INTERNAL );
+ strncpy2( convertBuff, labelName, JPILOT_LEN_LABEL );
+ g_free( labelName );
labelName = convertBuff;
}
struct AddressAppInfo *ai = & pilotFile->addrInfo;
for( i = 0; i < JPILOT_NUM_LABELS; i++ ) {
gchar *labelName = ai->labels[i];
- gchar convertBuff[JPILOT_LEN_LABEL];
if( labelName ) {
if( convert_charcode ) {
- conv_sjistoeuc( convertBuff, JPILOT_LEN_LABEL, labelName );
- labelName = convertBuff;
+ labelName = conv_codeset_strdup( labelName, CS_SHIFT_JIS, CS_INTERNAL );
}
- labelList = g_list_append( labelList, g_strdup( labelName ) );
+ else {
+ labelName = g_strdup( labelName );
+ }
+ labelList = g_list_append( labelList, labelName );
}
else {
labelList = g_list_append(
*/
GList *jpilot_load_custom_label( JPilotFile *pilotFile, GList *labelList ) {
gint i;
- char convertBuff[JPILOT_LEN_LABEL];
g_return_val_if_fail( pilotFile != NULL, NULL );
g_strchug( labelName );
if( *labelName != '\0' ) {
if( convert_charcode ) {
- conv_sjistoeuc( convertBuff, JPILOT_LEN_LABEL, labelName );
- labelName = convertBuff;
+ labelName = conv_codeset_strdup( labelName, CS_SHIFT_JIS, CS_INTERNAL );
+ }
+ else {
+ labelName = g_strdup( labelName );
}
- labelList = g_list_append( labelList, g_strdup( labelName ) );
+ labelList = g_list_append( labelList, labelName );
}
}
}
ItemFolder *folder = addritem_create_item_folder();
if( convert_charcode ) {
- gchar catName[ JPILOT_LEN_CATEG ];
- conv_sjistoeuc( catName, JPILOT_LEN_CATEG, cat->name[i] );
+ gchar *catName;
+ catName = conv_codeset_strdup( cat->name[i], CS_SHIFT_JIS, CS_INTERNAL );
addritem_folder_set_name( folder, catName );
+ g_free( catName );
}
else {
addritem_folder_set_name( folder, cat->name[i] );
{N_("/_View/_Code set/7bit ascii (US-ASC_II)"),
CODESET_ACTION(C_US_ASCII)},
-#if HAVE_ICONV
{N_("/_View/_Code set/Unicode (_UTF-8)"),
CODESET_ACTION(C_UTF_8)},
CODESET_SEPARATOR,
-#endif
{N_("/_View/_Code set/Western European (ISO-8859-_1)"),
CODESET_ACTION(C_ISO_8859_1)},
{N_("/_View/_Code set/Western European (ISO-8859-15)"),
CODESET_ACTION(C_ISO_8859_15)},
CODESET_SEPARATOR,
-#if HAVE_ICONV
{N_("/_View/_Code set/Central European (ISO-8859-_2)"),
CODESET_ACTION(C_ISO_8859_2)},
CODESET_SEPARATOR,
{N_("/_View/_Code set/Cyrillic (Windows-1251)"),
CODESET_ACTION(C_WINDOWS_1251)},
CODESET_SEPARATOR,
-#endif
{N_("/_View/_Code set/Japanese (ISO-2022-_JP)"),
CODESET_ACTION(C_ISO_2022_JP)},
-#if HAVE_ICONV
{N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"),
CODESET_ACTION(C_ISO_2022_JP_2)},
-#endif
{N_("/_View/_Code set/Japanese (_EUC-JP)"),
CODESET_ACTION(C_EUC_JP)},
{N_("/_View/_Code set/Japanese (_Shift__JIS)"),
CODESET_ACTION(C_SHIFT_JIS)},
-#if HAVE_ICONV
CODESET_SEPARATOR,
{N_("/_View/_Code set/Simplified Chinese (_GB2312)"),
CODESET_ACTION(C_GB2312)},
CODESET_ACTION(C_TIS_620)},
{N_("/_View/_Code set/Thai (Windows-874)"),
CODESET_ACTION(C_WINDOWS_874)},
-#endif
#undef CODESET_SEPARATOR
#undef CODESET_ACTION
BEGIN(0);
*string_buf_ptr = '\0';
if (!g_utf8_validate(string_buf, -1, NULL)) {
- gchar *tmp = conv_codeset_strdup(string_buf, conv_get_current_charset_str(), CS_UTF_8);
+ gchar *tmp = conv_codeset_strdup(string_buf, conv_get_locale_charset_str(), CS_INTERNAL);
if (tmp) {
strcpy(string_buf, tmp);
g_free(tmp);
{N_("/_View/_Code set/7bit ascii (US-ASC_II)"),
CODESET_ACTION(C_US_ASCII)},
-#if HAVE_ICONV
{N_("/_View/_Code set/Unicode (_UTF-8)"),
CODESET_ACTION(C_UTF_8)},
CODESET_SEPARATOR,
-#endif
{N_("/_View/_Code set/Western European (ISO-8859-_1)"),
CODESET_ACTION(C_ISO_8859_1)},
{N_("/_View/_Code set/Western European (ISO-8859-15)"),
CODESET_ACTION(C_ISO_8859_15)},
CODESET_SEPARATOR,
-#if HAVE_ICONV
{N_("/_View/_Code set/Central European (ISO-8859-_2)"),
CODESET_ACTION(C_ISO_8859_2)},
CODESET_SEPARATOR,
{N_("/_View/_Code set/Cyrillic (Windows-1251)"),
CODESET_ACTION(C_CP1251)},
CODESET_SEPARATOR,
-#endif
{N_("/_View/_Code set/Japanese (ISO-2022-_JP)"),
CODESET_ACTION(C_ISO_2022_JP)},
-#if HAVE_ICONV
{N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"),
CODESET_ACTION(C_ISO_2022_JP_2)},
-#endif
{N_("/_View/_Code set/Japanese (_EUC-JP)"),
CODESET_ACTION(C_EUC_JP)},
{N_("/_View/_Code set/Japanese (_Shift__JIS)"),
CODESET_ACTION(C_SHIFT_JIS)},
-#if HAVE_ICONV
CODESET_SEPARATOR,
{N_("/_View/_Code set/Simplified Chinese (_GB2312)"),
CODESET_ACTION(C_GB2312)},
CODESET_ACTION(C_TIS_620)},
{N_("/_View/_Code set/Thai (Windows-874)"),
CODESET_ACTION(C_WINDOWS_874)},
-#endif
#undef CODESET_SEPARATOR
#undef CODESET_ACTION
static gchar *mh_filename_from_utf8(const gchar *path)
{
const gchar *src_codeset = CS_UTF_8;
- const gchar *dest_codeset = conv_get_current_charset_str();
+ const gchar *dest_codeset = conv_get_locale_charset_str();
gchar *real_path;
real_path = conv_codeset_strdup(path, src_codeset, dest_codeset);
#warning FIXME_GTK2 /* should we use g_filename_to_utf8()? */
static gchar *mh_filename_to_utf8(const gchar *path)
{
- const gchar *src_codeset = conv_get_current_charset_str();
+ const gchar *src_codeset = conv_get_locale_charset_str();
const gchar *dest_codeset = CS_UTF_8;
gchar *utf8path;
gint plugin_init(gchar **error)
{
+ gchar *rcpath;
+
if ((sylpheed_get_version() > VERSION_NUMERIC)) {
*error = g_strdup("Your sylpheed version is newer than the version the plugin was built with");
return -1;
}
prefs_set_default(param);
- prefs_read_config(param, "ClamAV", COMMON_RC);
-
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
+ prefs_read_config(param, "ClamAV", rcpath, NULL);
+ g_free(rcpath);
+
debug_print("ClamAV plugin loaded\n");
return 0;
void dillo_prefs_init(void)
{
static gchar *path[3];
+ gchar *rcpath;
path[0] = _("Message View");
path[1] = _("Dillo Browser");
path[2] = NULL;
prefs_set_default(param);
- prefs_read_config(param, PREFS_BLOCK_NAME, COMMON_RC);
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
+ prefs_read_config(param, PREFS_BLOCK_NAME, rcpath, NULL);
+ g_free(rcpath);
prefs_page.page.path = path;
prefs_page.page.create_widget = create_dillo_prefs_page;
void image_viewer_prefs_init(void)
{
static gchar *path[3];
+ gchar *rcpath;
path[0] = _("Message View");
path[1] = _("Image Viewer");
path[2] = NULL;
prefs_set_default(param);
- prefs_read_config(param, PREFS_BLOCK_NAME, COMMON_RC);
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
+ prefs_read_config(param, PREFS_BLOCK_NAME, rcpath, NULL);
+ g_free(rcpath);
imageviewer_page.page.path = path;
imageviewer_page.page.create_widget = imageviewer_create_widget_func;
{
gchar *the_passphrase = NULL;
GtkWidget *vbox;
- GtkWidget *table;
- GtkWidget *pass_label;
GtkWidget *confirm_box;
GtkWidget *window;
GtkWidget *pass_entry;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), _("Passphrase"));
gtk_widget_set_size_request(window, 450, -1);
- gtk_container_set_border_width(GTK_CONTAINER(window), 4);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(window), TRUE);
gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
vbox = gtk_vbox_new(FALSE, 8);
gtk_container_add(GTK_CONTAINER(window), vbox);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
if (desc) {
GtkWidget *label;
label = create_description (desc);
- gtk_box_pack_start (GTK_BOX(vbox), label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX(vbox), label, FALSE, FALSE, 0);
}
- table = gtk_table_new(2, 2, FALSE);
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(table), 8);
- gtk_table_set_row_spacings(GTK_TABLE(table), 12);
- gtk_table_set_col_spacings(GTK_TABLE(table), 8);
-
-
- pass_label = gtk_label_new("");
- gtk_table_attach (GTK_TABLE(table), pass_label, 0, 1, 0, 1,
- GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (pass_label), 1, 0.5);
-
pass_entry = gtk_entry_new();
- gtk_table_attach (GTK_TABLE(table), pass_entry, 1, 2, 0, 1,
- GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
- gtk_entry_set_visibility (GTK_ENTRY(pass_entry), FALSE);
- gtk_widget_grab_focus (pass_entry);
-
-
- confirm_box = gtk_hbutton_box_new ();
- gtk_button_box_set_layout (GTK_BUTTON_BOX(confirm_box), GTK_BUTTONBOX_END);
- gtk_box_set_spacing (GTK_BOX(confirm_box), 5);
-
- ok_button = gtk_button_new_with_label (_("OK"));
- GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX(confirm_box), ok_button, TRUE, TRUE, 0);
-
- cancel_button = gtk_button_new_with_label (_("Cancel"));
- GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
- gtk_box_pack_start(GTK_BOX(confirm_box), cancel_button, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), pass_entry, FALSE, FALSE, 0);
+ gtk_entry_set_visibility(GTK_ENTRY(pass_entry), FALSE);
+ gtk_widget_grab_focus(pass_entry);
+ gtkut_stock_button_set_create(&confirm_box, &ok_button, GTK_STOCK_OK,
+ &cancel_button, GTK_STOCK_CANCEL,
+ NULL, NULL);
gtk_box_pack_end(GTK_BOX(vbox), confirm_box, FALSE, FALSE, 0);
- gtk_widget_grab_default (ok_button);
+ gtk_widget_grab_default(ok_button);
g_signal_connect(G_OBJECT(ok_button), "clicked",
G_CALLBACK(passphrase_ok_cb), NULL);
linelen (uid), uid, linelen (info), info);
label = gtk_label_new (buf);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
g_free (buf);
return label;
void prefs_gpg_init()
{
static gchar *path[3];
+ gchar *rcpath;
prefs_set_default(param);
- prefs_read_config(param, "GPG", COMMON_RC);
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
+ prefs_read_config(param, "GPG", rcpath, NULL);
+ g_free(rcpath);
path[0] = _("Privacy");
path[1] = _("GPG");
#include <gtk/gtkentry.h>
#include <gtk/gtkhbbox.h>
#include <gtk/gtkbutton.h>
-#include <gtk/gtksignal.h>
+#include <gtk/gtkstock.h>
#include "intl.h"
#include "select-keys.h"
g_signal_connect(G_OBJECT (showall_btn), "clicked",
G_CALLBACK(showall_btn_cb), sk);
- gtkut_button_set_create (&bbox,
- &select_btn, _("Select"),
- &cancel_btn, _("Cancel"),
- &other_btn, _("Other"));
+ gtkut_stock_button_set_create (&bbox,
+ &select_btn, _("Select"),
+ &cancel_btn, GTK_STOCK_CANCEL,
+ &other_btn, _("Other"));
gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
gtk_widget_grab_default (select_btn);
gint plugin_init(gchar **error)
{
+ gchar *rcpath;
+
if ((sylpheed_get_version() > VERSION_NUMERIC)) {
*error = g_strdup("Your sylpheed version is newer than the version the plugin was built with");
return -1;
}
prefs_set_default(param);
- prefs_read_config(param, "SpamAssassin", COMMON_RC);
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
+ prefs_read_config(param, "SpamAssassin", rcpath, NULL);
+ g_free(rcpath);
debug_print("Spamassassin plugin loaded\n");
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
void prefs_account_read_config(PrefsAccount *ac_prefs, const gchar *label)
{
const guchar *p = label;
+ gchar *rcpath;
gint id;
gchar **strv, **cur;
memset(&tmp_ac_prefs, 0, sizeof(PrefsAccount));
tmp_ac_prefs.privacy_prefs = ac_prefs->privacy_prefs;
- prefs_read_config(param, label, ACCOUNT_RC);
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, ACCOUNT_RC, NULL);
+ prefs_read_config(param, label, rcpath, NULL);
+ g_free(rcpath);
+
*ac_prefs = tmp_ac_prefs;
while (*p && !isdigit(*p)) p++;
id = atoi(p);
}
while (fgets(buf, sizeof(buf), fp) != NULL) {
- const gchar *src_codeset = conv_get_current_charset_str();
+ const gchar *src_codeset = conv_get_locale_charset_str();
const gchar *dest_codeset = CS_UTF_8;
gchar *tmp;
for (cur = prefs_common.actions_list; cur != NULL; cur = cur->next) {
gchar *tmp = (gchar *)cur->data;
const gchar *src_codeset = CS_UTF_8;
- const gchar *dest_codeset = conv_get_current_charset_str();
+ const gchar *dest_codeset = conv_get_locale_charset_str();
gchar *act;
act = conv_codeset_strdup(tmp, src_codeset, dest_codeset);
void prefs_common_read_config(void)
{
- prefs_read_config(param, "Common", COMMON_RC);
-
+ gchar *rcpath;
+
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
+ prefs_read_config(param, "Common", rcpath, NULL);
+ g_free(rcpath);
+
prefs_common.mime_open_cmd_history =
prefs_common_read_history(COMMAND_HISTORY);
prefs_common.summary_quicksearch_history =
SET_MENUITEM(_("Automatic (Recommended)"), CS_AUTO);
SET_MENUITEM(_("7bit ascii (US-ASCII)"), CS_US_ASCII);
-#if HAVE_ICONV
SET_MENUITEM(_("Unicode (UTF-8)"), CS_UTF_8);
-#endif
SET_MENUITEM(_("Western European (ISO-8859-1)"), CS_ISO_8859_1);
SET_MENUITEM(_("Western European (ISO-8859-15)"), CS_ISO_8859_15);
SET_MENUITEM(_("Central European (ISO-8859-2)"), CS_ISO_8859_2);
SET_MENUITEM(_("Baltic (ISO-8859-4)"), CS_ISO_8859_4);
SET_MENUITEM(_("Greek (ISO-8859-7)"), CS_ISO_8859_7);
SET_MENUITEM(_("Turkish (ISO-8859-9)"), CS_ISO_8859_9);
-#if HAVE_ICONV
SET_MENUITEM(_("Cyrillic (ISO-8859-5)"), CS_ISO_8859_5);
-#endif
SET_MENUITEM(_("Cyrillic (KOI8-R)"), CS_KOI8_R);
-#if HAVE_ICONV
SET_MENUITEM(_("Cyrillic (Windows-1251)"), CS_WINDOWS_1251);
SET_MENUITEM(_("Cyrillic (KOI8-U)"), CS_KOI8_U);
-#endif
SET_MENUITEM(_("Japanese (ISO-2022-JP)"), CS_ISO_2022_JP);
#if 0
SET_MENUITEM(_("Japanese (EUC-JP)"), CS_EUC_JP);
g_free(text);
text = conv_codeset_strdup(buffer,
- conv_get_current_charset_str(),
+ conv_get_locale_charset_str(),
CS_UTF_8);
if (!text)
text = g_strdup(buffer);
} DummyEnum;
void prefs_read_config(PrefParam *param, const gchar *label,
- const gchar *rcfile)
+ const gchar *rcfile, const gchar *encoding)
{
FILE *fp;
gchar buf[PREFSBUFSIZE];
- gchar *rcpath;
gchar *block_label;
g_return_if_fail(param != NULL);
prefs_set_default(param);
- rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, rcfile, NULL);
- if ((fp = fopen(rcpath, "rb")) == NULL) {
- if (ENOENT != errno) FILE_OP_ERROR(rcpath, "fopen");
- g_free(rcpath);
+ if ((fp = fopen(rcfile, "rb")) == NULL) {
+ if (ENOENT != errno) FILE_OP_ERROR(rcfile, "fopen");
return;
}
- g_free(rcpath);
block_label = g_strdup_printf("[%s]", label);
while (fgets(buf, sizeof(buf), fp) != NULL) {
gint val;
- val = strncmp(buf, block_label, strlen(block_label));
+ if (encoding) {
+ gchar *conv_str;
+
+ conv_str = conv_codeset_strdup
+ (buf, encoding, CS_INTERNAL);
+ if (!conv_str)
+ conv_str = g_strdup(buf);
+ val = strncmp
+ (conv_str, block_label, strlen(block_label));
+ g_free(conv_str);
+ } else
+ val = strncmp(buf, block_label, strlen(block_label));
if (val == 0) {
debug_print("Found %s\n", block_label);
break;
/* reached next block */
if (buf[0] == '[') break;
- prefs_config_parse_one_line(param, buf);
+ if (encoding) {
+ gchar *conv_str;
+
+ conv_str = conv_codeset_strdup
+ (buf, encoding, CS_INTERNAL);
+ if (!conv_str)
+ conv_str = g_strdup(buf);
+ prefs_config_parse_one_line(param, conv_str);
+ g_free(conv_str);
+ } else
+ prefs_config_parse_one_line(param, buf);
}
debug_print("Finished reading configuration.\n");
tmp = *value ?
conv_codeset_strdup(value,
- conv_get_current_charset_str(),
+ conv_get_locale_charset_str(),
CS_UTF_8)
: g_strdup("");
if (!tmp) {
if (*((gchar **)param[i].data)) {
tmp = conv_codeset_strdup(*((gchar **)param[i].data),
CS_UTF_8,
- conv_get_current_charset_str());
+ conv_get_locale_charset_str());
if (!tmp)
tmp = g_strdup(*((gchar **)param[i].data));
}
envstr = g_getenv(param[i].defval + 4);
tmp = envstr && *envstr ?
conv_codeset_strdup(envstr,
- conv_get_current_charset_str(),
+ conv_get_locale_charset_str(),
CS_UTF_8)
: g_strdup("");
if (!tmp) {
void prefs_read_config (PrefParam *param,
const gchar *label,
- const gchar *rcfile);
+ const gchar *rcfile,
+ const gchar *encoding);
void prefs_config_parse_one_line(PrefParam *param,
const gchar *buf);
void prefs_write_config (PrefParam *param,
\
if (!g_utf8_validate(text, -1, NULL)) \
tmpstr = conv_codeset_strdup(text, \
- conv_get_current_charset_str(), CS_UTF_8); \
+ conv_get_locale_charset_str(), CS_UTF_8); \
else \
tmpstr = g_strdup(text); \
\
else
strftime(dest, len, default_format, lt);
- src_codeset = conv_get_current_charset_str();
+ src_codeset = conv_get_locale_charset_str();
dest_codeset = CS_UTF_8;
str = conv_codeset_strdup(dest, src_codeset, dest_codeset);
if (str) {
case ENC_AS_EXTENDED:
g_string_append_printf(buf, "%s*=%s''", param,
- conv_get_current_charset_str());
+ conv_get_locale_charset_str());
for (valpos = val; *valpos != '\0'; valpos++) {
if (IS_ASCII(*valpos) && isalnum(*valpos)) {
g_string_append_printf(buf, "%c", *valpos);
len = strlen(str) + 1;
Xalloca(out, len, return);
-
- conv_localetodisp(out, len, str);
- if (!g_utf8_validate(out, -1, NULL)) {
- gchar *buf;
- gint buflen;
- const gchar *src_codeset, *dest_codeset;
- src_codeset = conv_get_current_charset_str();
- dest_codeset = CS_UTF_8;
- buf = conv_codeset_strdup(out, src_codeset, dest_codeset);
- gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
- gtk_text_buffer_insert(buffer, &iter, buf, -1);
- g_free(buf);
- } else {
- gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
- gtk_text_buffer_insert(buffer, &iter, out, -1);
- }
+ conv_utf8todisp(out, len, str);
+
+ gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
+ gtk_text_buffer_insert(buffer, &iter, out, -1);
}
static void source_window_size_alloc_cb(GtkWidget *widget,
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
GtkWidget *statusbar;
statusbar = gtk_statusbar_new();
-
+ gtk_widget_set_size_request(statusbar, 1, -1);
statusbar_list = g_list_append(statusbar_list, statusbar);
gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(statusbar),
FALSE);
{
gint cid;
gchar *buf;
+ gchar *tmp;
- buf = g_strdup(str);
- strretchomp(buf);
- if (strlen(buf) > 76) {
- wchar_t *wbuf;
-
- wbuf = strdup_mbstowcs(buf);
-
- if (wcslen(wbuf) > 60) {
- gchar *tmp;
-
- g_free(buf);
- wbuf[60] = (wchar_t)0;
- tmp = strdup_wcstombs(wbuf);
- buf = g_strconcat(tmp, "...", NULL);
- g_free(tmp);
- }
-
- g_free(wbuf);
- }
+ tmp = g_strdup(str);
+ strretchomp(tmp);
+ buf = trim_string(tmp, 76);
+ g_free(tmp);
cid = gtk_statusbar_get_context_id(statusbar, "Standard Output");
gtk_statusbar_pop(statusbar, cid);
gchar *oldstr = filename;
filename = conv_codeset_strdup(filename,
CS_UTF_8,
- conv_get_current_charset_str());
+ conv_get_locale_charset_str());
if (!filename) {
g_warning("summary_save_as(): faild to convert character set.");
filename = g_strdup(oldstr);
buffer = gtk_text_view_get_buffer(text);
gtk_text_buffer_get_end_iter(buffer, &iter);
- if (!conv) {
+ if (!conv)
strncpy2(buf, str, sizeof(buf));
- } else if (conv_convert(conv, buf, sizeof(buf), str) < 0) {
- conv_localetodisp(buf, sizeof(buf), str);
- }
+ else if (conv_convert(conv, buf, sizeof(buf), str) < 0)
+ conv_utf8todisp(buf, sizeof(buf), str);
strcrchomp(buf);
//if (prefs_common.conv_mb_alnum) conv_mb_alnum(buf);
buffer = gtk_text_view_get_buffer(text);
gtk_text_buffer_get_end_iter(buffer, &iter);
-#warning FIXME_GTK2
-#if 0
- if (!conv) {
- if (textview->text_is_mb)
- conv_localetodisp(buf, sizeof(buf), str);
- else
- strncpy2(buf, str, sizeof(buf));
- } else if (conv_convert(conv, buf, sizeof(buf), str) < 0)
- conv_localetodisp(buf, sizeof(buf), str);
- else if (textview->text_is_mb)
- conv_unreadable_locale(buf);
-#else
if (!conv)
strncpy2(buf, str, sizeof(buf));
else if (conv_convert(conv, buf, sizeof(buf), str) < 0)
- conv_localetodisp(buf, sizeof(buf), str);
-#endif
+ conv_utf8todisp(buf, sizeof(buf), str);
strcrchomp(buf);
g_free( fileSpec );
if( pfile ) {
fp = pfile->fp;
- fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n",
- conv_get_current_charset_str());
+ fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n", CS_INTERNAL);
fprintf(fp, "<%s>\n", TOOLBAR_TAG_INDEX);
continue;
}
- /* convert to locale encoding */
- conv_str = conv_codeset_strdup(decoded_text, charset, CS_UTF_8);
+ /* convert to UTF-8 */
+ conv_str = conv_codeset_strdup(decoded_text, charset, NULL);
if (conv_str) {
len = strlen(conv_str);
memcpy(outp, conv_str, len);
g_free(conv_str);
} else {
len = strlen(decoded_text);
- conv_localetodisp(outp, len + 1, decoded_text);
+ conv_utf8todisp(outp, len + 1, decoded_text);
}
outp += len;