mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 12:00:21 +02:00
Merge from stable-2.2
This commit is contained in:
commit
967f129f80
1 changed files with 5 additions and 6 deletions
|
@ -2195,11 +2195,13 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t ilen, len, i;
|
size_t ilen, len, i;
|
||||||
int ret;
|
int ret;
|
||||||
const char *enc;
|
|
||||||
|
|
||||||
if (!scm_is_string (str))
|
if (!scm_is_string (str))
|
||||||
scm_wrong_type_arg_msg (NULL, 0, str, "string");
|
scm_wrong_type_arg_msg (NULL, 0, str, "string");
|
||||||
|
|
||||||
|
if (encoding == NULL)
|
||||||
|
encoding = "ISO-8859-1";
|
||||||
|
|
||||||
if (c_strcasecmp (encoding, "UTF-8") == 0)
|
if (c_strcasecmp (encoding, "UTF-8") == 0)
|
||||||
/* This is the most common case--e.g., when calling libc bindings
|
/* This is the most common case--e.g., when calling libc bindings
|
||||||
while using a UTF-8 locale. */
|
while using a UTF-8 locale. */
|
||||||
|
@ -2247,13 +2249,10 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
|
||||||
|
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
len = 0;
|
len = 0;
|
||||||
enc = encoding;
|
|
||||||
if (enc == NULL)
|
|
||||||
enc = "ISO-8859-1";
|
|
||||||
if (scm_i_is_narrow_string (str))
|
if (scm_i_is_narrow_string (str))
|
||||||
{
|
{
|
||||||
ret = mem_iconveh (scm_i_string_chars (str), ilen,
|
ret = mem_iconveh (scm_i_string_chars (str), ilen,
|
||||||
"ISO-8859-1", enc,
|
"ISO-8859-1", encoding,
|
||||||
(enum iconv_ilseq_handler) handler, NULL,
|
(enum iconv_ilseq_handler) handler, NULL,
|
||||||
&buf, &len);
|
&buf, &len);
|
||||||
|
|
||||||
|
@ -2266,7 +2265,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buf = u32_conv_to_encoding (enc,
|
buf = u32_conv_to_encoding (encoding,
|
||||||
(enum iconv_ilseq_handler) handler,
|
(enum iconv_ilseq_handler) handler,
|
||||||
(uint32_t *) scm_i_string_wide_chars (str),
|
(uint32_t *) scm_i_string_wide_chars (str),
|
||||||
ilen,
|
ilen,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue