summaryrefslogtreecommitdiff
path: root/lisp/net/puny.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2017-03-01 20:35:41 -0500
committerGlenn Morris <rgm@gnu.org>2017-03-01 20:35:41 -0500
commit8c1e16bee492f7f8776805cfc051801e3da5cd20 (patch)
tree6f5aaee0adc6432183ed981b4aba05fb800f8307 /lisp/net/puny.el
parent8244357283b740adacaa4526c0ea60349b0a93bb (diff)
downloademacs-8c1e16bee492f7f8776805cfc051801e3da5cd20.tar.gz
Small puny.el fix
* lisp/net/puny.el (puny-decode-string-internal): Handle strings with no ascii parts. (Bug#23688)
Diffstat (limited to 'lisp/net/puny.el')
-rw-r--r--lisp/net/puny.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/net/puny.el b/lisp/net/puny.el
index c718d958be1..bdd59be070a 100644
--- a/lisp/net/puny.el
+++ b/lisp/net/puny.el
@@ -150,10 +150,12 @@ For instance \"xn--bcher-kva\" => \"bücher\"."
(defun puny-decode-string-internal (string)
(with-temp-buffer
(insert 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))
+ (point))
+ (point-max)))
(ic 0)
(i 0)
(bias puny-initial-bias)