diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-06-19 14:52:46 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2018-08-07 12:10:32 +0200 |
commit | 25c719b41294176677f82c511e8e1ca50793b18c (patch) | |
tree | d60fbde3551c7a61514fc0b13ba7748cdeb4a147 /libguile/strings.c | |
parent | edc80bd595a442d059098fd6b605bbe1aa7e81ca (diff) | |
download | guile-25c719b41294176677f82c511e8e1ca50793b18c.tar.gz |
Add 'scm_to_stringn' shortcut when converting to UTF-8.
* libguile/strings.c (scm_to_stringn): Call 'scm_to_utf8_stringn' when
ENCODING == "UTF-8".
Diffstat (limited to 'libguile/strings.c')
-rw-r--r-- | libguile/strings.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libguile/strings.c b/libguile/strings.c index cee64cd08..a0a1555f5 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -2177,6 +2177,12 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding, if (!scm_is_string (str)) scm_wrong_type_arg_msg (NULL, 0, str, "string"); + + if (c_strcasecmp (encoding, "UTF-8") == 0) + /* This is the most common case--e.g., when calling libc bindings + while using a UTF-8 locale. */ + return scm_to_utf8_stringn (str, lenp); + ilen = scm_i_string_length (str); if (ilen == 0) |