From 40621e704d5180c39880820234b01034c241204f Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Wed, 30 Dec 2015 09:59:30 +0100 Subject: [PATCH] Transform non-restrictive domains to punycode for display * lisp/net/eww.el (eww): Check whether the domain is Highly Restrictive in the Unicode IDNA sense. --- lisp/net/eww.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 7ec58f15028..88dfb0214b9 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -275,6 +275,13 @@ word(s) will be searched for via `eww-search-prefix'." (setq url (concat eww-search-prefix (replace-regexp-in-string " " "+" url)))))) (eww-setup-buffer) + ;; Check whether the domain only uses "Highly Restricted" Unicode + ;; IDNA characters. If not, transform to punycode to indicate that + ;; there may be funny business going on. + (let ((parsed (url-generic-parse-url url))) + (unless (puny-highly-restrictive-p (url-host parsed)) + (setf (url-host parsed) (puny-encode-domain (url-host parsed))) + (setq url (url-recreate-url parsed)))) (plist-put eww-data :url url) (plist-put eww-data :title "") (eww-update-header-line-format) -- 2.11.4.GIT