From 412053922501e2e9cac7fc0c1b91de8fc3aa375a Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Wed, 3 Apr 2013 16:00:12 -0400 Subject: [PATCH] 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'. --- libguile/ports.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libguile/ports.c b/libguile/ports.c index 61f800685..eaa204788 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -2385,7 +2385,6 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding) descriptor. */ if (strcasecmp (encoding, "UTF-8") == 0) { - pt->encoding = "UTF-8"; pti->encoding_mode = SCM_PORT_ENCODING_MODE_UTF8; pti->iconv_descriptors = NULL; } @@ -2396,9 +2395,9 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding) 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);