# HG changeset patch # User ib # Date 1390226829 0 # Node ID 4e24aeb9ae64023f011f5c625c5268d15b1d8443 # Parent 67e2b2a5ce427b1a3687d7944cc6dac709559f66 Improve the dialog for subtitle encodings with iconv. Add only available encodings from the full list to avoid possible confusion. diff -r 67e2b2a5ce42 -r 4e24aeb9ae64 gui/dialog/preferences.c --- a/gui/dialog/preferences.c Sun Jan 19 22:24:53 2014 +0000 +++ b/gui/dialog/preferences.c Mon Jan 20 14:07:09 2014 +0000 @@ -58,6 +58,10 @@ #include "libmpcodecs/vd.h" #include "libmpcodecs/ad.h" +#ifdef CONFIG_ICONV +#include +#endif + GtkWidget * Preferences = NULL; static GtkWidget * AConfig; static GtkWidget * VConfig; @@ -787,7 +791,17 @@ CBSubEncoding_items=g_list_append( CBSubEncoding_items,MSGTR_PREFERENCES_None ); { int i; - for ( i=0;lEncoding[i].name;i++ ) CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment ); + iconv_t cd; + for ( i=0;lEncoding[i].name;i++ ) + { + cd=iconv_open( lEncoding[i].name,"UTF-8" ); + + if (cd != (iconv_t) -1) + { + iconv_close(cd); + CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment ); + } + } } gtk_combo_set_popdown_strings( GTK_COMBO( CBSubEncoding ),CBSubEncoding_items ); g_list_free( CBSubEncoding_items );