Have string ports honor `%default-port-encoding'.
authorLudovic Courtès <ludo@gnu.org>
Thu, 7 Jan 2010 10:00:37 +0000 (11:00 +0100)
committerLudovic Courtès <ludo@gnu.org>
Thu, 7 Jan 2010 10:10:35 +0000 (11:10 +0100)
commit7b0419128bce68f48a158292430ed4a7202aa1b1
treeda697b566d45d144d2c23310ac34de7c29e60666
parent29bcdbb05948a5f12d2d8cb36a0c3c582e738be3
Have string ports honor `%default-port-encoding'.

* libguile/strports.c (scm_i_mkstrport): Remove.
  (scm_mkstrport): Don't change the port's encoding to UTF-8; convert
  STR to the default port encoding.
  (scm_strport_to_string): Fix documentation & indentation.

* libguile/strports.h (scm_i_mkstrport): Remove.

* test-suite/lib.scm (exception:encoding-error): New variable.
  (format-test-name): Set `%default-port-encoding' to "UTF-8".

* test-suite/tests/ports.test ("string ports")["%default-port-encoding
  is honored", "suitable encoding [latin-1]", "suitable encoding
  [latin-3]", "wrong encoding"]: New tests.

* test-suite/tests/r6rs-ports.test ("7.2.11 Binary
  Output")["put-bytevector with UTF-16 string port", "put-bytevector
  with wrong-encoding string port"]: New tests.

* test-suite/tests/reader.test (read-string): Set
  `%default-port-encoding' to `#f'.
  ("reading")["unprintable symbol"]: Use a string that doesn't contain
  zeros.

* doc/ref/api-io.texi (String Ports): Document encoding issues with
  `call-with-output-string' and `with-output-to-string'.
doc/ref/api-io.texi
libguile/strports.c
libguile/strports.h
test-suite/lib.scm
test-suite/tests/ports.test
test-suite/tests/r6rs-ports.test
test-suite/tests/reader.test