wmail: handle allocation failures.
[dockapps.git] / wmcliphist / utils.c
bloba1ce1b8f8abedd054656d83d3d1424b54d937f81
1 #include "wmcliphist.h"
3 /*
4 * converts text in UTF-8 to charset by actual locale
5 */
6 gchar *
7 from_utf8(gchar *string) {
8 gsize bytes_read;
9 gsize bytes_written;
10 GError *error;
11 gchar *converted;
12 /* gchar *error_msg; */
13 /* gint error_code; */
15 converted = g_locale_from_utf8(string, -1, &bytes_read, &bytes_written,
16 &error);
17 /* error_code = (error == NULL) ? 0 : error->code; */
19 * fprintf(stderr, "from_utf8: %d b read, %d b written, error: %d\n",
20 * bytes_read, bytes_written, error_code);
23 return converted;