1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-15 10:10:21 +02:00

Fix bytevector and custom binary ports to actually use ISO-8859-1 encoding.

Fixes <http://bugs.gnu.org/20200>, introduced in
  commit 337edc591f.
Reported by David Kastrup <dak@gnu.org>.

* libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop):
  After setting port encoding = NULL, update 'encoding_mode'
  accordingly.
* libguile/ports.c (scm_i_set_port_encoding_x): Add warning comment.
* test-suite/tests/r6rs-ports.test: Add tests.
This commit is contained in:
Mark H Weaver 2015-03-28 16:01:23 -04:00
parent 2c032c2215
commit d574d96f87
3 changed files with 59 additions and 0 deletions

View file

@ -2580,6 +2580,11 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding)
because we do I/O ourselves. This saves 100+ KiB for each
descriptor. */
pt->encoding = scm_gc_strdup (encoding, "port");
/* IMPORTANT: If the set of encoding modes is changed, or if more
would need to be done after setting pt->encoding = NULL, then
update 'make_bip', 'make_cbip', 'make_bop', and 'make_cbop' in
r6rs-ports.c accordingly. This will be cleaned up in 2.2. */
if (c_strcasecmp (encoding, "UTF-8") == 0)
pti->encoding_mode = SCM_PORT_ENCODING_MODE_UTF8;
else