Re: ustring::validate() costs?
- From: Chris Vine <chris cvine freeserve co uk>
- To: gtkmm-list gnome org
- Cc: Matthias Kaeppler <matthias finitestate org>
- Subject: Re: ustring::validate() costs?
- Date: Sat, 3 Dec 2005 18:58:55 +0000
On Saturday 03 December 2005 12:39, Matthias Kaeppler wrote:
[snip]
> Okay, I see. I guess my system is really messed up then, since I
> obviously have exactly this problem: Some (or even most) of my files are
> neither encoded in UTF-8 nor in my locale's encoding (that's why
> g_filename_to_utf8() fails because I haven't set these variables properly).
I doubt that you have filenames other than in your locale codeset or UTF-8.
You appear to have some of each - you probably created files with Nautilus
and because you did not have G_FILENAME_ENCODING or G_BROKEN_FILENAMES set it
made the name in UTF-8, and all your others (including those you created via
the console) are in your locale codeset.
> It would be nice to figure out in my program for /each/ file I read, in
> which character set it is encoded. Is this possible? I only found
> functions so far which can either read the locale's character set or
> check if some filename is valid UTF-8 (or not), but no function which
> individually probes for a certain file in which character set its
> filename is encoded.
>
> This would solve my problem, since I could then use Glib::convert()
> directly to convert from and to the correct encoding for each filename
> individually. Maybe this is how Nautilus does it (since it doesn't have
> any problems reading my files, I guess it has at least /some/ clever
> mechanism to detect for each file if a conversion is necessary and if
> so, from which character encoding it has to convert to UTF-8). Looks as
> if I have to peek at the Nautilus source again, but if you have any good
> ideas how to solve this without setting these environment variables I'm
> all ears :)
I doubt that is your problem, or that Nautilus bothers to try and deduce your
codeset for you if it is in neither your locale codeset nor UTF-8 nor
specified in the G_FILENAME_ENCODING environmental variable. However, as you
say you can look at the Nautilus source code.
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]