[Spice-devel] [spice-gtk v1] file-xfer: Fix bad filename encoding

Christophe Fergeau cfergeau at redhat.com
Thu Apr 13 08:50:31 UTC 2017


On Thu, Apr 13, 2017 at 10:29:13AM +0200, Victor Toso wrote:
> Hi,
> 
> On Wed, Apr 12, 2017 at 04:19:06PM +0200, Christophe Fergeau wrote:
> > On Wed, Apr 12, 2017 at 03:55:04PM +0200, Victor Toso wrote:
> > > I'm not specialist on possible problems but although ascii is compatible
> > > with utf8 it might become a problem to not have a standard well defined
> > > in the future although Marc-André said it should be UTF-8.
> >
> > If you mandate UTF-8 in the protocol, you probably cause a regression if
> > your client has an iso8859-1 filename, and you dnd that to a VM where
> > you also expect the iso8859-1 filename.
> 
> If we enforce utf-8 that would means converting twice, iso8859-1 to
> utf-8 for the protocol and utf-8 to is8859-1 in the guest.

Ah, I did not mention that I was assuming no changes in the agents.

Note that I would not assume that we can know in general the encoding of
a non-UTF-8 filename, it's usually going to be the same encoding as the
one used system-wide, but if you start adding USB disks to the mix
moving between systems using different legacy encodings, this is no
longer true. Take for example a FAT-formatted USB key with japanese
filenames, plug it into your English Windows, I believe you cannot know
which encoding the filename is in, so your "iso8859-1" example above
generally means "byte array with unknown encoding", which is what we've
got now..

> All in all, having a weird filename is not a major problem IMHO; The
> main problem is not having the file transferred at all. I guess the
> windows agent need some work to avoid that in the future.
> 
> This is just a proposal for something more consistent... I'm totally
> fine to fix this a regression by 'reverting' the change to use
> g_file_get_basename(), I'll send a v2 with that soon.

Yup, fully agree about the problem to solve, and that what you suggest
should solve it. Alternatively g_file_info_get_attribute_byte_string()
which was suggested before in the thread should do the job too.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170413/7f110ce8/attachment.sig>


More information about the Spice-devel mailing list