[MPlayer-dev-eng] [PATCH] Allow gmplayer the use of non-UTF-8 filename encoding
Ingo Brueckl
ib at wupperonline.de
Mon Dec 20 11:05:57 CET 2010
Reimar Döffinger wrote on Sun, 19 Dec 2010 21:49:48 and 23:37:58 +0100:
> Also, does restoring the old locale this way actually work?
In principle yes, but there was a bug.
> LC_ALL modifies multiple locale settings, do they all get
> restored correctly
Apparently. Please see the output of a test program:
Starting with no locale set:
LC_ALL = C
LC_CTYPE = C
LC_NUMERIC = C
Setting LC_CTYPE=tr:
LC_ALL = LC_CTYPE=tr;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
LC_CTYPE = tr
LC_NUMERIC = C
Setting LC_NUMERIC=en:
LC_ALL = LC_CTYPE=tr;LC_NUMERIC=en;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
LC_CTYPE = tr
LC_NUMERIC = en
Saving locale.
Setting LC_ALL=de:
LC_ALL = de
LC_CTYPE = de
LC_NUMERIC = de
Restoring locale:
LC_ALL = LC_CTYPE=tr;LC_NUMERIC=en;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
LC_CTYPE = tr
LC_NUMERIC = en
As there is no setlocale allowed in MPlayer so far, its locale during
runtime is C anyway. So, for the moment, it would be ok to reset it to C,
but it is safer to restore, just in case.
> I do wonder a bit what that function actually uses and if you really have
> to change all LC_*...
Glib's _g_locale_charset_raw() reads LC_CYTPE, but only on modern systems
providing nl_langinfo(). It reads LC_ALL, LC_CTYPE, LANG (in that order)
else, so it is safest to set LC_ALL to work on all systems.
> Are you sure that gtk_clist_append makes a copy if the string?
Now I am. Gtk's set_cell_contents() which does the work for
gtk_clist_append() makes a g_strdup(text);
Attached is 3rd attempt.
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmplayer.utf8.patch
Type: application/octet-stream
Size: 11005 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20101220/32ddef10/attachment.obj>
More information about the MPlayer-dev-eng
mailing list