/* $Id$ * FUSE interface module utf8 conversions for libcaptive * Copyright (C) 2003-2005 Jan Kratochvil * * 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 * the Free Software Foundation; exactly version 2 of June 1991 is required * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" #include "utf8.h" /* self */ #include #include #include #include char *capfuse_filename_to_utf8_malloc_errorchecking(const char *name) { GError *error; char *r; g_return_val_if_fail(name!=NULL,NULL); error=NULL; r=g_filename_to_utf8( name, /* opsysstring */ -1, /* len; '\0'-terminated */ NULL, /* bytes_read */ NULL, /* bytes_written */ &error); /* error */ if (error) { g_log(G_LOG_DOMAIN,G_LOG_LEVEL_WARNING, _("captive-FUSE %s(): name=\"%s\": %s (see locale(7) and mount(8) environment variables)"), "g_filename_to_utf8",name,error->message); g_clear_error(&error); } return r; } char *capfuse_filename_from_utf8_malloc_errorchecking(const char *name) { GError *error; char *r; g_return_val_if_fail(name!=NULL,NULL); error=NULL; r=g_filename_from_utf8( name, /* utf8string */ -1, /* len; '\0'-terminated */ NULL, /* bytes_read */ NULL, /* bytes_written */ &error); /* error */ if (error) { const gchar *charset; g_get_charset(&charset); g_log(G_LOG_DOMAIN,G_LOG_LEVEL_WARNING,"captive-FUSE %s(): name=\"%s\"; g_get_charset()=\"%s\", %s: %s", "g_filename_from_utf8",name,charset, _("see environment variables - locale(7), mount(8) and locale(1) commands \"locale\" and \"locale -a\""), error->message); g_clear_error(&error); } return r; }