mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 17:50:29 +02:00
Support for Unicode string normalization functions
* libguile/strings.c, libguile/strings.h (normalize_str, scm_string_normalize_nfc, scm_string_normalize_nfd, scm_normalize_nfkc, scm_string_normalize_nfkd): New functions. * test-suite/tests/strings.test: Unit tests for `string-normalize-nfc', `string-normalize-nfd', `string-normalize-nfkc', and `string-normalize-nfkd'. * doc/ref/api-data.texi (String Comparison): Documentation for normalization functions.
This commit is contained in:
parent
441891f376
commit
edb7bb4766
4 changed files with 182 additions and 0 deletions
|
@ -385,6 +385,46 @@
|
|||
(eq? (char-ci>=? (integer->char 0) (integer->char 255))
|
||||
(string-ci>=? (string-ints 0) (string-ints 255)))))
|
||||
|
||||
;;
|
||||
;; Unicode string normalization forms
|
||||
;;
|
||||
|
||||
;;
|
||||
;; string-normalize-nfd
|
||||
;;
|
||||
|
||||
(with-test-prefix "string-normalize-nfd"
|
||||
|
||||
(pass-if "canonical decomposition is equal?"
|
||||
(equal? (string-normalize-nfd "\xe9") "\x65\u0301")))
|
||||
|
||||
;;
|
||||
;; string-normalize-nfkd
|
||||
;;
|
||||
|
||||
(with-test-prefix "string-normalize-nfkd"
|
||||
|
||||
(pass-if "compatibility decomposition is equal?"
|
||||
(equal? (string-normalize-nfkd "\u1e9b\u0323") "s\u0323\u0307")))
|
||||
|
||||
;;
|
||||
;; string-normalize-nfc
|
||||
;;
|
||||
|
||||
(with-test-prefix "string-normalize-nfc"
|
||||
|
||||
(pass-if "canonical composition is equal?"
|
||||
(equal? (string-normalize-nfc "\x65\u0301") "\xe9")))
|
||||
|
||||
;;
|
||||
;; string-normalize-nfkc
|
||||
;;
|
||||
|
||||
(with-test-prefix "string-normalize-nfkc"
|
||||
|
||||
(pass-if "compatibility composition is equal?"
|
||||
(equal? (string-normalize-nfkc "\u1e9b\u0323") "\u1e69")))
|
||||
|
||||
;;
|
||||
;; string-ref
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue