summaryrefslogtreecommitdiff
path: root/libguile/strings.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-03-17 18:29:08 +0100
committerAndy Wingo <wingo@pobox.com>2011-03-17 18:29:08 +0100
commit95f5e303bc7f6174255b12fd1113d69364863762 (patch)
tree5df2b7bdefc7082075e7af6fe9af38ec87e66ec9 /libguile/strings.c
parentbb455e4f94d8e339c9b8a69e178110cf3dfa5bcb (diff)
downloadguile-95f5e303bc7f6174255b12fd1113d69364863762.tar.gz
scm_{to,from}_locale_string use current locale, not current ports
* libguile/strings.c (scm_to_locale_stringn, scm_from_locale_stringn): Use the encoding of the current locale, not of the current i/o ports. Also use the current conversion strategy. * doc/ref/api-data.texi (Conversion to/from C): Update docs.
Diffstat (limited to 'libguile/strings.c')
-rw-r--r--libguile/strings.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/libguile/strings.c b/libguile/strings.c
index b13cb780f..6f4004b3d 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1528,25 +1528,8 @@ scm_from_locale_string (const char *str)
SCM
scm_from_locale_stringn (const char *str, size_t len)
{
- const char *enc;
- scm_t_string_failed_conversion_handler hndl;
- SCM inport;
- scm_t_port *pt;
-
- inport = scm_current_input_port ();
- if (!SCM_UNBNDP (inport) && SCM_OPINPORTP (inport))
- {
- pt = SCM_PTAB_ENTRY (inport);
- enc = pt->encoding;
- hndl = pt->ilseq_handler;
- }
- else
- {
- enc = NULL;
- hndl = SCM_FAILED_CONVERSION_ERROR;
- }
-
- return scm_from_stringn (str, len, enc, hndl);
+ return scm_from_stringn (str, len, locale_charset (),
+ scm_i_get_conversion_strategy (SCM_BOOL_F));
}
SCM
@@ -1771,21 +1754,8 @@ scm_to_locale_string (SCM str)
char *
scm_to_locale_stringn (SCM str, size_t *lenp)
{
- SCM outport;
- scm_t_port *pt;
- const char *enc;
-
- outport = scm_current_output_port ();
- if (!SCM_UNBNDP (outport) && SCM_OPOUTPORTP (outport))
- {
- pt = SCM_PTAB_ENTRY (outport);
- enc = pt->encoding;
- }
- else
- enc = NULL;
-
return scm_to_stringn (str, lenp,
- enc,
+ locale_charset (),
scm_i_get_conversion_strategy (SCM_BOOL_F));
}