1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 22:40:34 +02:00

Preserve the case of the user-specified port encoding string.

* libguile/ports.c (scm_i_set_port_encoding_x): Always copy the
  user-provided port encoding string, so that its case will be preserved
  and returned exactly by subsequent calls to 'port-encoding'.
This commit is contained in:
Mark H Weaver 2013-04-03 16:00:12 -04:00
parent c3e3ef6eb6
commit 4120539225

View file

@ -2385,7 +2385,6 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding)
descriptor. */ descriptor. */
if (strcasecmp (encoding, "UTF-8") == 0) if (strcasecmp (encoding, "UTF-8") == 0)
{ {
pt->encoding = "UTF-8";
pti->encoding_mode = SCM_PORT_ENCODING_MODE_UTF8; pti->encoding_mode = SCM_PORT_ENCODING_MODE_UTF8;
pti->iconv_descriptors = NULL; pti->iconv_descriptors = NULL;
} }
@ -2396,9 +2395,9 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding)
open_iconv_descriptors (encoding, open_iconv_descriptors (encoding,
SCM_INPUT_PORT_P (port), SCM_INPUT_PORT_P (port),
SCM_OUTPUT_PORT_P (port)); SCM_OUTPUT_PORT_P (port));
pt->encoding = scm_gc_strdup (encoding, "port");
pti->encoding_mode = SCM_PORT_ENCODING_MODE_ICONV; pti->encoding_mode = SCM_PORT_ENCODING_MODE_ICONV;
} }
pt->encoding = scm_gc_strdup (encoding, "port");
if (prev) if (prev)
close_iconv_descriptors (prev); close_iconv_descriptors (prev);