Re: ustring::validate() costs?



Chris Vine wrote:
Yes, I am only referring to the names of files, not their contents. I
don't think what you say is true though. For example, on my notebook my
lcoale is set to ISO-8859-1 and if I create a file in Nautilus, then
Nautilus will encode the name in UTF-8 and not in my current locale
encoding. Maybe that's what you are referring to in your other post but
it's very likely that this happens, actually.


But does it do it if you have G_BROKEN_FILENAMES or G_FILENAME_ENCODING correctly set (before you start Nautilus, which usually occurs when GNOME starts up)? If it does, you probably need to report a bug.

No, they are not set on my system when starting GNOME. I would have to set them manually. Frankly, I still don't see the point, and I have a feeling that 90% of today's Nautilus users have never heard of these environment variables and don't set them correctly either. Which is another story of course :)

I just want to say, I find it a highly awkward approach to let the user set some variables about which he most probably doesn't even care (in the sense that he just wants the program to make sure that no inconsistencies between codesets occur). From what you said, I'd guess they only become useful in rather exotic situations, but still, the user has to always set them.

Your code setting environmental variables is pointless. If you want to convert filenames from the locale codeset to UTF8 (if the filename codeset is not UTF-8) as a mandatory policy in your program, use Glib::locale_to_utf8(). It is bizarre to programatically set G_BROKEN_FILENAMES or G_FILENAME_ENCODING so that Glib::filename_to_utf8() will do the same thing.

Yes, with this background, that sounds reasonable. I think it's highly irritating though that g_filename_to_utf8() isn't the suggested way to convert filenames to UTF-8, but rather g_locale_to_utf8() (I think this is essentially what you said right?). It would be very nice to have this information in the API reference directly.

Though it is not relevant for the reasons mentioned above, you should not set both G_BROKEN_FILENAMES and G_FILENAME_ENCODING - you set one or the other. If you set both, glib resolves the conflict by choosing G_FILENAME_ENCODING.

That's also good to know, thanks Chris.

Best regards,
Matthias Kaeppler




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