mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
intl: Fork get_cp_config_name off get_cp_mime_name.
This may help with bug 914 but I'm not testing that yet.
This commit is contained in:
parent
aa79ecfe72
commit
8c66e34323
@ -322,7 +322,7 @@ cp_set(struct option *opt, unsigned char *str)
|
||||
static void
|
||||
cp_wr(struct option *o, struct string *s)
|
||||
{
|
||||
unsigned char *mime_name = get_cp_mime_name(o->value.number);
|
||||
unsigned char *mime_name = get_cp_config_name(o->value.number);
|
||||
|
||||
add_optstring_to_string(s, mime_name, strlen(mime_name));
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ charset_list(struct terminal *term, void *xxx, void *ses_)
|
||||
|
||||
items++;
|
||||
add_to_menu(&mi, name, NULL, ACT_MAIN_NONE,
|
||||
display_codepage, get_cp_mime_name(i), 0);
|
||||
display_codepage, get_cp_config_name(i), 0);
|
||||
}
|
||||
|
||||
/* Special codepages are not in the menu and it may cause assertion
|
||||
|
@ -1427,6 +1427,11 @@ free_charsets_lookup(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Get the codepage's name for displaying to the user, or NULL if
|
||||
* @cp_index is one past the end. In the future, we might want to
|
||||
* localize these with gettext. So it may be best not to use this
|
||||
* function if the name will have to be converted back to an
|
||||
* index. */
|
||||
unsigned char *
|
||||
get_cp_name(int cp_index)
|
||||
{
|
||||
@ -1436,11 +1441,27 @@ get_cp_name(int cp_index)
|
||||
return codepages[cp_index].name;
|
||||
}
|
||||
|
||||
/* Get the codepage's name for saving to a configuration file. These
|
||||
* names can be converted back to indexes, even in future versions of
|
||||
* ELinks. */
|
||||
unsigned char *
|
||||
get_cp_config_name(int cp_index)
|
||||
{
|
||||
if (cp_index < 0) return "none";
|
||||
if (cp_index & SYSTEM_CHARSET_FLAG) return "System";
|
||||
if (!codepages[cp_index].aliases) return NULL;
|
||||
|
||||
return codepages[cp_index].aliases[0];
|
||||
}
|
||||
|
||||
/* Get the codepage's name for sending to a library or server that
|
||||
* understands MIME charset names. This function irreversibly maps
|
||||
* the "System" codepage to the underlying charset. */
|
||||
unsigned char *
|
||||
get_cp_mime_name(int cp_index)
|
||||
{
|
||||
if (cp_index < 0) return "none";
|
||||
if (cp_index & SYSTEM_CHARSET_FLAG) return "System";
|
||||
cp_index &= ~SYSTEM_CHARSET_FLAG;
|
||||
if (!codepages[cp_index].aliases) return NULL;
|
||||
|
||||
return codepages[cp_index].aliases[0];
|
||||
|
@ -106,6 +106,7 @@ unsigned char *convert_string(struct conv_table *convert_table,
|
||||
|
||||
int get_cp_index(unsigned char *);
|
||||
unsigned char *get_cp_name(int);
|
||||
unsigned char *get_cp_config_name(int);
|
||||
unsigned char *get_cp_mime_name(int);
|
||||
int is_cp_utf8(int);
|
||||
void free_conv_table(void);
|
||||
|
@ -579,7 +579,7 @@ l_get_option(LS)
|
||||
{
|
||||
unsigned char *cp_name;
|
||||
|
||||
cp_name = get_cp_mime_name(opt->value.number);
|
||||
cp_name = get_cp_config_name(opt->value.number);
|
||||
lua_pushstring(S, cp_name);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user