Make puny-encode-string normalize first
* lisp/net/puny.el (puny-encode-string): Normalize before encoding (bug#51954).
This commit is contained in:
parent
19e78601a0
commit
023dc2ac8f
2 changed files with 8 additions and 0 deletions
|
|
@ -43,6 +43,7 @@ For instance, \"fśf.org\" => \"xn--ff-2sa.org\"."
|
|||
"Encode STRING according to the IDNA/punycode algorithm.
|
||||
This is used to encode non-ASCII domain names.
|
||||
For instance, \"bücher\" => \"xn--bcher-kva\"."
|
||||
(setq string (downcase (string-glyph-compose string)))
|
||||
(let ((ascii (seq-filter (lambda (char)
|
||||
(< char 128))
|
||||
string)))
|
||||
|
|
|
|||
|
|
@ -61,4 +61,11 @@
|
|||
;; Only allowed in unrestricted.
|
||||
(should-not (puny-highly-restrictive-domain-p "I♥NY.org")))
|
||||
|
||||
(ert-deftest puny-normalize ()
|
||||
(should (equal (puny-encode-string (string-glyph-compose "Bä.com"))
|
||||
"xn--b.com-gra"))
|
||||
(should (equal (puny-encode-string "Bä.com")
|
||||
"xn--b.com-gra"))
|
||||
(should (equal (puny-encode-string "Bä.com") "xn--b.com-gra")))
|
||||
|
||||
;;; puny-tests.el ends here
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue