diff options
Diffstat (limited to 'libguile/strings.c')
-rw-r--r-- | libguile/strings.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libguile/strings.c b/libguile/strings.c index 03ead8138..21295addf 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -1379,7 +1379,7 @@ scm_is_string (SCM obj) return IS_STRING (obj); } -static SCM +SCM scm_from_stringn (const char *str, size_t len, const char *encoding, scm_t_string_failed_conversion_handler handler) { @@ -1388,6 +1388,9 @@ scm_from_stringn (const char *str, size_t len, const char *encoding, int wide = 0; SCM res; + if (len == 0) + return scm_nullstr; + if (encoding == NULL) { /* If encoding is null, use Latin-1. */ @@ -1575,7 +1578,7 @@ unistring_escapes_to_guile_escapes (char **bufp, size_t *lenp) } char * -scm_to_locale_stringn (SCM str, size_t * lenp) +scm_to_locale_stringn (SCM str, size_t *lenp) { SCM outport; scm_t_port *pt; @@ -1682,6 +1685,8 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding, scm_list_2 (scm_from_locale_string (enc), str)); } + if (handler == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE) + unistring_escapes_to_guile_escapes (&buf, &len); } if (lenp) *lenp = len; |