* 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'.
descriptor. */
if (strcasecmp (encoding, "UTF-8") == 0)
{
- pt->encoding = "UTF-8";
pti->encoding_mode = SCM_PORT_ENCODING_MODE_UTF8;
pti->iconv_descriptors = NULL;
}
open_iconv_descriptors (encoding,
SCM_INPUT_PORT_P (port),
SCM_OUTPUT_PORT_P (port));
- pt->encoding = scm_gc_strdup (encoding, "port");
pti->encoding_mode = SCM_PORT_ENCODING_MODE_ICONV;
}
+ pt->encoding = scm_gc_strdup (encoding, "port");
if (prev)
close_iconv_descriptors (prev);