summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-03-14 23:28:12 +0100
committerLudovic Courtès <ludo@gnu.org>2010-03-14 23:41:10 +0100
commitd3b5628c6de88ee08787aab5b1af96f913b77ed4 (patch)
treedda1976ea0d4340d64ab26c8d0447369b2f26201
parentf11871d6c557e706b80e7fa6c0c1f1da854fe1c4 (diff)
downloadguile-d3b5628c6de88ee08787aab5b1af96f913b77ed4.tar.gz
doc: Remove obsolete reference to the lack of Unicode support.
* doc/ref/api-data.texi (Bytevectors as Strings): Remove obsolete footnote on the lack of Unicode support. * test-suite/tests/bytevectors.test ("2.9 Operations on Strings")["string->utf8 [latin-1]", "utf8->string [latin-1]"]: Remove use of `with-latin1-locale'. ["string->utf32 [Greek]"]: New tests.
-rwxr-xr-xdoc/ref/api-data.texi7
-rw-r--r--test-suite/tests/bytevectors.test33
2 files changed, 20 insertions, 20 deletions
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index d413567e5..8153a5d1b 100755
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -4406,12 +4406,7 @@ the host's native endianness.
@cindex Unicode string encoding
Bytevector contents can also be interpreted as Unicode strings encoded
-in one of the most commonly available encoding formats@footnote{Guile
-1.8 does @emph{not} support Unicode strings. Therefore, the procedures
-described here assume that Guile strings are internally encoded
-according to the current locale. For instance, if @code{$LC_CTYPE} is
-@code{fr_FR.ISO-8859-1}, then @code{string->utf-8} @i{et al.} will
-assume that Guile strings are Latin-1-encoded.}.
+in one of the most commonly available encoding formats.
@lisp
(utf8->string (u8-list->bytevector '(99 97 102 101)))
diff --git a/test-suite/tests/bytevectors.test b/test-suite/tests/bytevectors.test
index 3f68c81f6..3a7cc2db3 100644
--- a/test-suite/tests/bytevectors.test
+++ b/test-suite/tests/bytevectors.test
@@ -1,7 +1,7 @@
-;;;; bytevectors.test --- R6RS bytevectors. -*- mode: scheme; coding: iso-8859-1; -*-
+;;;; bytevectors.test --- R6RS bytevectors. -*- mode: scheme; coding: utf-8; -*-
;;;;
;;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
-;;;; Ludovic Courtès
+;;;; Ludovic Courtès
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -394,12 +394,11 @@
(map integer->char (bytevector->u8-list utf8))))))
(pass-if "string->utf8 [latin-1]"
- (with-latin1-locale
- (let* ((str "hé, ça va bien ?")
- (utf8 (string->utf8 str)))
- (and (bytevector? utf8)
- (= (bytevector-length utf8)
- (+ 2 (string-length str)))))))
+ (let* ((str "hé, ça va bien ?")
+ (utf8 (string->utf8 str)))
+ (and (bytevector? utf8)
+ (= (bytevector-length utf8)
+ (+ 2 (string-length str))))))
(pass-if "string->utf16"
(let* ((str "hello, world")
@@ -435,6 +434,13 @@
(bytevector->uint-list utf32
(endianness big) 4))))))
+ (pass-if "string->utf32 [Greek]"
+ (let* ((str "Ἄνεμοι")
+ (utf32 (string->utf32 str)))
+ (and (bytevector? utf32)
+ (equal? (bytevector->uint-list utf32 (endianness big) 4)
+ '(#x1f0c #x3bd #x3b5 #x3bc #x3bf #x3b9)))))
+
(pass-if "string->utf32 [little]"
(let* ((str "hello, world")
(utf32 (string->utf32 str (endianness little))))
@@ -457,12 +463,11 @@
(map integer->char (bytevector->u8-list utf8))))))
(pass-if "utf8->string [latin-1]"
- (with-latin1-locale
- (let* ((utf8 (string->utf8 "hé, ça va bien ?"))
- (str (utf8->string utf8)))
- (and (string? str)
- (= (string-length str)
- (- (bytevector-length utf8) 2))))))
+ (let* ((utf8 (string->utf8 "hé, ça va bien ?"))
+ (str (utf8->string utf8)))
+ (and (string? str)
+ (= (string-length str)
+ (- (bytevector-length utf8) 2)))))
(pass-if "utf16->string"
(let* ((utf16 (uint-list->bytevector (map char->integer