[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23688: 25.1.50; Incorrect punycode decoding for names without ASCII
bug#23688: 25.1.50; Incorrect punycode decoding for names without ASCII characters
Wed, 01 Mar 2017 20:39:17 -0500
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
Magnus Henoch wrote:
> When decoding an IDN label that doesn't contain any ASCII characters,
> the function puny-decode-string-internal would skip the first letter,
> thereby returning gibberish instead of the expected result.
> That is, the example in the puny-decode-string docstring,
> "xn--bcher-kva", would be decoded correctly since it finds the "kva"
> part after the last dash, but my domain "xn--9dbdkw.se" would not,
> since there is no "last dash".
> This patch seems to fix the problem:
Thanks. That patch did not seem quite right (eg try it on "xn--bcher-kva"),
so I applied the following, which works for me.
Date: Wed Mar 1 20:35:41 2017 -0500
Small puny.el fix
* lisp/net/puny.el (puny-decode-string-internal):
Handle strings with no ascii parts. (Bug#23688)
diff --git a/lisp/net/puny.el b/lisp/net/puny.el
index c718d95..bdd59be 100644
@@ -150,10 +150,12 @@ For instance \"xn--bcher-kva\" => \"bücher\"."
(defun puny-decode-string-internal (string)
- (goto-char (point-max))
- (search-backward "-" nil (point-min))
- ;; The encoded chars are after the final dash.
- (let ((encoded (buffer-substring (1+ (point)) (point-max)))
+ ;; The encoded chars are after any final dash, else the whole string.
+ (let ((encoded (buffer-substring
+ (if (search-backward "-" nil 'move)
+ (1+ (point))
- bug#23688: 25.1.50; Incorrect punycode decoding for names without ASCII characters,
Glenn Morris <=