summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2015-10-24 15:21:47 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2015-10-24 15:21:47 +0100
commitef202aeef57d8766ea368d3148c550a97c604ae7 (patch)
tree6e7717e91b2e544bd1cf077592b63740fc5f5f3f /render
parentc752c85618a57f8c82dc2e939ba2bf735e6c8372 (diff)
parentaabea8eceb8d77cef934e7b4d0cd2015f1103411 (diff)
downloadnetsurf-ef202aeef57d8766ea368d3148c550a97c604ae7.tar.gz
netsurf-ef202aeef57d8766ea368d3148c550a97c604ae7.tar.bz2
Merge branch 'chris/display-idna'
This enables frontends to display international domain names in UTF-8, instead of the encoded versions. It is disabled by default, as some frontends cannot display the full range of UTF-8 characters in their status or URL bar.
Diffstat (limited to 'render')
-rw-r--r--render/html_interaction.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 6e2a2df4c..1b2e5b9c9 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -300,6 +300,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
enum { ACTION_NONE, ACTION_SUBMIT, ACTION_GO } action = ACTION_NONE;
const char *title = 0;
nsurl *url = 0;
+ char *url_s = NULL;
+ size_t url_l = 0;
const char *target = 0;
char status_buffer[200];
const char *status = 0;
@@ -814,12 +816,26 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
y - html_object_pos_y);
}
} else if (url) {
+ if (nsoption_bool(display_decoded_idn) == true) {
+ if (nsurl_access_utf8(url, &url_s, &url_l) != NSERROR_OK) {
+ /* Unable to obtain a decoded IDN. This is not a fatal error.
+ * Ensure the string pointer is NULL so we use the encoded version. */
+ url_s = NULL;
+ }
+ }
+
if (title) {
snprintf(status_buffer, sizeof status_buffer, "%s: %s",
- nsurl_access(url), title);
- status = status_buffer;
- } else
- status = nsurl_access(url);
+ url_s ? url_s : nsurl_access(url), title);
+ } else {
+ snprintf(status_buffer, sizeof status_buffer, "%s",
+ url_s ? url_s : nsurl_access(url));
+ }
+
+ status = status_buffer;
+
+ if (url_s != NULL)
+ free(url_s);
pointer = get_pointer_shape(url_box, imagemap);