Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwife.git;a=commitdiff;h=0f882f719b562cc54dec18f590c0126a9fd9d18b
commit 0f882f719b562cc54dec18f590c0126a9fd9d18b Author: Elentir <elen...@mailoo.org> Date: Tue Jul 14 22:17:05 2009 +0200 replace macro by function for utf8 conversion diff --git a/src/fwife.h b/src/fwife.h index 5c98d82..21b72cc 100644 --- a/src/fwife.h +++ b/src/fwife.h @@ -48,8 +48,6 @@ #define SHARED_LIB_EXT ".so" -#define GET_UTF8(chaine) g_locale_to_utf8(chaine, -1, NULL, NULL, NULL) - /* Structure of a plugins */ typedef struct { diff --git a/src/util.c b/src/util.c index d03aeac..86a6ac9 100644 --- a/src/util.c +++ b/src/util.c @@ -395,3 +395,19 @@ int cmp_str(gconstpointer a, gconstpointer b) return(strcmp(a, b)); } +gchar *fwife_convert_to_utf8 (const char *str) +{ + gchar *ret = NULL; + GError *error = NULL; + if (str) + { + ret = g_convert (str, strlen(str), "UTF-8", "", NULL, NULL, &error); + if (ret == NULL) + { + LOG("Error converting string to utf-8: %s\n", error->message); + } + } + + return ret; +} + diff --git a/src/util.h b/src/util.h index 29d57f6..9e382cf 100644 --- a/src/util.h +++ b/src/util.h @@ -39,7 +39,7 @@ #ifdef _ #undef _ #endif -#define _(text) gettext(text) +#define _(text) fwife_convert_to_utf8(gettext(text)) #define MALLOC(p, b) do { if((b) > 0) \ { p = malloc(b); if (!(p)) \ @@ -61,6 +61,7 @@ typedef struct } data_t; data_t *data_new(void); +gchar *fwife_convert_to_utf8(const char *str); long long get_freespace(); void *data_get(GList *config, char *title); void data_put(GList **config, char *name, void *data); _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git