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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 12, 2017 at 01:57:19PM +0200, Victor Toso wrote:
> On Wed, Apr 12, 2017 at 07:18:54AM -0400, Marc-André Lureau wrote:
> > Hi
> > 
> > ----- Original Message -----
> > > From: Victor Toso <me@xxxxxxxxxxxxxx>
> > > 
> > > Manual for G_FILE_ATTRIBUTE_STANDARD_NAME states:
> > >  > The name is the on-disk filename which may not be in any known
> > >  > encoding, and can thus not be generally displayed as is.
> > > 
> > > Considering a file named "ěščřžýáíé", if we use
> > > G_FILE_ATTRIBUTE_STANDARD_NAME get the file name, we will have the
> > > following 72 char long string:
> > > "\xc4\x9b\xc5\xa1\xc4\x8d\xc5\x99\xc5\xbe\xc3\xbd\xc3\xa1\xc3\xad\xc3\xa9"
> > > 
> > > We should be use G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME instead which
> > > will give us the correct 18 long utf-8 string: "ěščřžýáíé"
> > > 
> > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1440206
> > > 
> > > Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
> > 
> > I suppose this happens when the filename encoding isn't utf8,
> > ack
> 
> I think it is utf8 but G_FILE_ATTRIBUTE_STANDARD_NAME give the bytes as
> string instead, did not checked why.

I guess because of "The base name is a byte string (not UTF-8). It has
no defined encoding or rules other than it may not contain zero bytes.",
and the string returned by g_file_info_get_attribute_as_string() has to
be valid UTF-8, so this is probably the best which can be done.

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]