mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
bug 153, 1066: Convert strings to edit-bookmark dialog from UTF-8.
This commit is contained in:
parent
5a29dbc4a1
commit
8c0fa7f09c
@ -387,18 +387,38 @@ push_edit_button(struct dialog_data *dlg_data, struct widget_data *edit_btn)
|
||||
/* Follow the bookmark */
|
||||
if (box->sel) {
|
||||
struct bookmark *bm = (struct bookmark *) box->sel->udata;
|
||||
/** @todo Bug 153: bm->title should be UTF-8.
|
||||
* @todo Bug 1066: bm->url should be UTF-8. */
|
||||
const unsigned char *title = bm->title;
|
||||
const unsigned char *url = bm->url;
|
||||
int utf8_cp = get_cp_index("UTF-8");
|
||||
int term_cp = get_terminal_codepage(dlg_data->win->term);
|
||||
struct conv_table *convert_table;
|
||||
|
||||
convert_table = get_translation_table(utf8_cp, term_cp);
|
||||
if (convert_table) {
|
||||
unsigned char *title;
|
||||
unsigned char *url;
|
||||
|
||||
title = convert_string(convert_table,
|
||||
bm->title, strlen(bm->title),
|
||||
term_cp, CSM_NONE,
|
||||
NULL, NULL, NULL);
|
||||
url = convert_string(convert_table,
|
||||
bm->url, strlen(bm->url),
|
||||
term_cp, CSM_NONE,
|
||||
NULL, NULL, NULL);
|
||||
if (title && url) {
|
||||
object_lock(bm);
|
||||
do_edit_dialog(dlg_data->win->term, 1, N_("Edit bookmark"),
|
||||
do_edit_dialog(dlg_data->win->term, 1,
|
||||
N_("Edit bookmark"),
|
||||
title, url,
|
||||
(struct session *) dlg_data->dlg->udata, dlg_data,
|
||||
bookmark_edit_done, bookmark_edit_cancel,
|
||||
(struct session *) dlg_data->dlg->udata,
|
||||
dlg_data,
|
||||
bookmark_edit_done,
|
||||
bookmark_edit_cancel,
|
||||
(void *) bm, EDIT_DLG_ADD);
|
||||
}
|
||||
mem_free_if(title);
|
||||
mem_free_if(url);
|
||||
}
|
||||
}
|
||||
|
||||
return EVENT_PROCESSED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user