diff --git a/src/selcodepage.c b/src/selcodepage.c index 4f7fa3e85..0c54443c3 100644 --- a/src/selcodepage.c +++ b/src/selcodepage.c @@ -93,21 +93,16 @@ int do_select_codepage (void) { const char *errmsg; + int r; - if (display_codepage > 0) { - source_codepage = select_charset (source_codepage, 0); - errmsg = - init_translation_table (source_codepage, display_codepage); - if (errmsg) { - message (D_ERROR, MSG_ERROR, "%s", errmsg); - return -1; - } - } else { - message (D_ERROR, _("Warning"), - _("To use this feature select your codepage in\n" - "Setup / Display Bits dialog!\n" - "Do not forget to save options.")); - return -1; + r = select_charset (source_codepage, 0); + if ( r > 0 ) + source_codepage = r; + + errmsg = init_translation_table (source_codepage, display_codepage); + if (errmsg) { + message (D_ERROR, MSG_ERROR, "%s", errmsg); + return -1; } return 0; } diff --git a/src/setup.c b/src/setup.c index 636db0592..a5426faa3 100644 --- a/src/setup.c +++ b/src/setup.c @@ -378,6 +378,8 @@ save_setup (void) #ifdef HAVE_CHARSET save_string( "Misc", "display_codepage", get_codepage_id( display_codepage ), profile_name ); + save_string( "Misc", "source_codepage", + get_codepage_id( source_codepage ), profile_name ); #endif /* HAVE_CHARSET */ g_free (profile); @@ -581,8 +583,11 @@ load_setup (void) cpname, sizeof(cpname) ); if ( cpname[0] != '\0' ) display_codepage = get_codepage_index( cpname ); + load_string( "Misc", "source_codepage", "", + cpname, sizeof(cpname) ); + if ( cpname[0] != '\0' ) + source_codepage = get_codepage_index( cpname ); } - init_translation_table( source_codepage, display_codepage ); #endif /* HAVE_CHARSET */ }