Re: Format/Encoding of Drag-and-drop data
- From: Damon Chaplin <damon karuna uklinux net>
- To: Gaurav Jain <gaurav anywhere gmail com>
- Cc: gtk-app-devel-list gnome org, gtk-i18n-list gnome org
- Subject: Re: Format/Encoding of Drag-and-drop data
- Date: Wed, 03 Aug 2005 12:30:46 +0100
On Wed, 2005-08-03 at 16:05 +0530, Gaurav Jain wrote:
> Hi,
>
> I'm trying to support drag-and-drop functionality in which any file
> can be dragged from the explorer, such as Nautilus, and dropped onto
> my application. My application is supposed to try and open this file.
>
> I need to support ANY file name, including complex scripts, so I need
> to know the format in which the data in the drop target is received.
> It doesn't look like UTF-8, because the bytes in the filename look all
> mangled up. For example, when I drop a file whose filename is in
> arabic, that is UTF-8 values of {-40, -87, '\0'), then the actual
> bytes received in the data at the drop target are: {37, 68, 56, 37,
> 65, 57, \0'} (all values shown in decimal). The latter list is not a
> valid UTF-8 string, and obviously not the same as the first list,
> which I expected it to be.
>
> The value of the "format" field in the GtkSelectionData structure is
> equal to 8, but I don't know the actual encoding of the data. Could
> somebody help me out with this?
It looks like it is URI-encoded, using hexadecimal for non-ascii
characters. See:
http://www.w3.org/International/O-URL-code.html
You can use gnome_vfs_unescape_string() to convert it back to UTF-8.
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]