mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-16 17:22:44 +03:00
Pass the URL bar contents back as UTF-8.
This commit is contained in:
parent
3b9df4f796
commit
abc7a71117
@ -83,6 +83,7 @@ struct url_bar {
|
||||
wimp_i text_icon;
|
||||
char *text_buffer;
|
||||
size_t text_size;
|
||||
char *text_buffer_utf8;
|
||||
|
||||
wimp_i suggest_icon;
|
||||
int suggest_x, suggest_y;
|
||||
@ -508,6 +509,9 @@ void ro_gui_url_bar_destroy(struct url_bar *url_bar)
|
||||
if (url_bar == NULL)
|
||||
return;
|
||||
|
||||
if (url_bar->text_buffer_utf8 != NULL)
|
||||
free(url_bar->text_buffer_utf8);
|
||||
|
||||
free(url_bar);
|
||||
}
|
||||
|
||||
@ -1073,6 +1077,15 @@ const char *ro_gui_url_bar_get_url(struct url_bar *url_bar)
|
||||
if (url_bar == NULL)
|
||||
return NULL;
|
||||
|
||||
if (url_bar->text_buffer_utf8 != NULL) {
|
||||
free(url_bar->text_buffer_utf8);
|
||||
url_bar->text_buffer_utf8 = NULL;
|
||||
}
|
||||
|
||||
if (utf8_from_local_encoding(url_bar->text_buffer, 0, &url_bar->text_buffer_utf8) == NSERROR_OK) {
|
||||
return (const char *) url_bar->text_buffer_utf8;
|
||||
}
|
||||
|
||||
return (const char *) url_bar->text_buffer;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user