aboutsummaryrefslogtreecommitdiff
path: root/iconv/gconv_open.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-11-29 05:00:56 +0000
committerUlrich Drepper <drepper@redhat.com>2001-11-29 05:00:56 +0000
commite0e86ccb1d2848678b5c32f65bf6239ba5fb9d24 (patch)
treed2db260a028fd346925bdc815e3774d3b6135666 /iconv/gconv_open.c
parentc6baa867d3d57ca3eb89226b44ad696960d869cd (diff)
downloadglibc-e0e86ccb1d2848678b5c32f65bf6239ba5fb9d24.tar
glibc-e0e86ccb1d2848678b5c32f65bf6239ba5fb9d24.tar.gz
glibc-e0e86ccb1d2848678b5c32f65bf6239ba5fb9d24.tar.bz2
glibc-e0e86ccb1d2848678b5c32f65bf6239ba5fb9d24.zip
Update.
* iconv/gconv_open.c (__gconv_open): Empty codeset name now means using the current locale's codeset. * iconv/iconv_open.c (iconv_open): Don't strip out everything for empty input string. * iconv/iconv_prog.c: Pass empty strings as default value for to- and from-charset. Don't determine locale's charset here. if libio is used [PR libc/2575].
Diffstat (limited to 'iconv/gconv_open.c')
-rw-r--r--iconv/gconv_open.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c
index dfcd7b772f..94a54f8008 100644
--- a/iconv/gconv_open.c
+++ b/iconv/gconv_open.c
@@ -20,6 +20,7 @@
#include <errno.h>
#include <locale.h>
+#include "../locale/localeinfo.h"
#include <stdlib.h>
#include <string.h>
@@ -149,6 +150,25 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
fromset = memcpy (newfromset, fromset, ignore - fromset);
}
+ /* If the string is empty define this to mean the charset of the
+ currently selected locale. */
+ if (strcmp (toset, "//") == 0)
+ {
+ const char *codeset = _NL_CURRENT (LC_CTYPE, CODESET);
+ size_t len = strlen (codeset);
+ char *dest;
+ toset = dest = (char *) alloca (len + 3);
+ memcpy (__mempcpy (dest, codeset, len), "//", 3);
+ }
+ if (strcmp (fromset, "//") == 0)
+ {
+ const char *codeset = _NL_CURRENT (LC_CTYPE, CODESET);
+ size_t len = strlen (codeset);
+ char *dest;
+ fromset = dest = (char *) alloca (len + 3);
+ memcpy (__mempcpy (dest, codeset, len), "//", 3);
+ }
+
res = __gconv_find_transform (toset, fromset, &steps, &nsteps, flags);
if (res == __GCONV_OK)
{