Re: Exposing get_filename_charset



On Tue, 2004-11-02 at 12:11 -0500, Matthias Clasen wrote:
> On Mon, 2004-11-01 at 10:21 +0100, Alexander Larsson wrote:
> > On Sun, 2004-10-31 at 20:19 +0000, Tor Lillqvist wrote:
> > > Alexander Larsson writes:
> > >  > The local files part of nautilus_file_get_display_name currently goes
> > >  > like:
> > > 
> > > If I understood that code correctly, it patches the display name
> > > together from valid UTF-8 snippets in the string and question marks? I
> > > think instead of question marks it would be more useful to use
> > > something like g_strescape() of the whole string. I don't think file
> > > names that are partially in UTF-8 and partially in something else
> > > occur very often, so using the portions of the string that happen to
> > > be valid UTF-8 as such is probably wrong, and it would be better to
> > > just output all of the non-ASCII bytes in octal or hex.
> > >
> > > Would this be OK:
> > 
> > Not trying to convert from various likely encodings makes this fail for
> > many common cases. The eel fallback code with question marks might not
> > be ideal, but in reality it isn't hit that often. I'm not sure that
> > showing escaped characters in the user interface is any better though.
> 
> 
> Alex, does this look like a reasonable first attempt ? 
> Based on the nautilus code you posted earlier, and only very
> superficially tested:

It looks basically all right, although it depends a bit on what
g_get_filename_charsets() returns in the default case. The one thing
thats missing is to try to convert from the locale encoding if that
isn't utf8 and the filename encoding isn't utf8.

If g_get_filename_charsets() returns "UTF-8, locale-charset" by default
everything should work fine. And doing that makes sense to me.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a suave guerilla boxer searching for his wife's true killer. She's a 
blind tomboy vampire living homeless in New York's sewers. They fight crime! 




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