summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 452dde6)
raw | patch | inline | side by side (parent: 452dde6)
author | Kalle Wallin <kaw@linux.se> | |
Mon, 29 Mar 2004 19:43:12 +0000 (19:43 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Mon, 29 Mar 2004 19:43:12 +0000 (19:43 +0000) |
support.c | patch | blob | history |
diff --git a/support.c b/support.c
index becd60b3156718208515ef354f336bc6717f5f71..bf60132775aebd3829ba87f7c5fa002f621c6c74 100644 (file)
--- a/support.c
+++ b/support.c
char *
utf8_to_locale(char *utf8str)
{
- char *str;
+ gchar *str;
+ gsize rb, wb;
+ GError *error;
if( noconvert )
return g_strdup(utf8str);
- if( (str=g_locale_from_utf8(utf8str, -1, NULL, NULL, NULL)) == NULL )
- return g_strdup(utf8str);
+
+ rb = 0; /* bytes read */
+ wb = 0; /* bytes written */
+ error = NULL;
+ str=g_locale_from_utf8(utf8str,
+ g_utf8_strlen(utf8str,-1),
+ &wb, &rb,
+ &error);
+ if( error )
+ {
+ g_printerr("utf8_to_locale(): %s\n", error->message);
+ g_error_free(error);
+ return g_strdup(utf8str);
+ }
+
return str;
}
char *
locale_to_utf8(char *localestr)
{
- char *str;
+ gchar *str;
+ gsize rb, wb;
+ GError *error;
if( noconvert )
return g_strdup(localestr);
- if( (str=g_locale_to_utf8(localestr, -1, NULL, NULL, NULL)) == NULL )
- return g_strdup(localestr);
+
+ rb = 0; /* bytes read */
+ wb = 0; /* bytes written */
+ error = NULL;
+ str=g_locale_to_utf8(localestr,
+ -1,
+ &wb, &rb,
+ &error);
+ if( error )
+ {
+ g_printerr("locale_to_utf8: %s\n", error->message);
+ g_error_free(error);
+ return g_strdup(localestr);
+ }
+
return str;
}