Hmm..., it looks like the problem is not in gnome-obex-send.
There is no character encoding conversion codes in the source code of
gnome-obex-send.

Perhaps, the problem is in libbtctl.
In the function btctl_obexclient_source_push, it calls OBEX_CharToUnicode to
convert a filename to Unicode as following.

libbtctl-0.10.0/src/obex-client-source.c:
gboolean
btctl_obexclient_source_push (BtctlObexclientSource *bc,
                gchar *fname, const guchar * data, guint len)
{
...snip...
        bfname = g_path_get_basename (fname);
        uname_size = (strlen (bfname)+1)*2;
        uname = g_malloc (uname_size);
        OBEX_CharToUnicode (uname, bfname, uname_size);


OBEX_CharToUnicode converts a string to an Unicode string, however that function
seems not support non-ASCII or multibyte encoding.
Therefore it breaks non-ASCII characters.

I suggest to call g_convert instead of OBEX_CharToUnicode to support non-ASCII
or multibyte encoding.
I have attached a patch.

Regards,

-- 
Morita Sho <[email protected]>
--- libbtctl-0.10.0/src/obex-client-source.c.orig	2009-02-08 14:27:56.000000000 +0900
+++ libbtctl-0.10.0/src/obex-client-source.c	2009-02-08 14:28:03.000000000 +0900
@@ -307,6 +307,7 @@
 	guint uname_size;
 	gchar *uname;
 	gchar *bfname;
+	const gchar **charsets;
 
 	if (!bc->initialised) {
 		g_warning ("Not initialised.");
@@ -325,9 +326,12 @@
 	}
 
 	bfname = g_path_get_basename (fname);
-	uname_size = (strlen (bfname)+1)*2;
-	uname = g_malloc (uname_size);
-	OBEX_CharToUnicode (uname, bfname, uname_size);
+	g_get_filename_charsets (&charsets);
+	uname = g_convert (bfname, -1, "UTF-16BE", charsets[0], NULL, &uname_size, NULL);
+	if (uname == NULL) {
+		g_warning ("Failed to convert the filename to UTF-16BE");
+		return FALSE;
+	}
 
 	hd.bs = uname;
 	OBEX_ObjectAddHeader (bc->handle, object,

Reply via email to