mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
24609: try to be safe about using libiconv
This commit is contained in:
parent
e21bd541a2
commit
4ff6e11df2
3 changed files with 30 additions and 4 deletions
6
MACHINES
6
MACHINES
|
@ -212,7 +212,11 @@ Sun: SunOS 4.1.x
|
|||
This may work, but the first username completion will be _very_
|
||||
slow (as slow as in tcsh).
|
||||
|
||||
Sun: Solaris 2.x, 8, 9
|
||||
Sun: Solaris 2.x, 8, 9, ...
|
||||
It is recommended that the system library version of iconv()
|
||||
be used rather than libiconv since there are incompatibilities
|
||||
in the way codesets are named.
|
||||
|
||||
The UCB versions of the routines for reading directories are not
|
||||
usable (the struct definitions are incompatible with the ones
|
||||
assumed by zsh). The symptom of this is that globbed filenames in
|
||||
|
|
23
Src/utils.c
23
Src/utils.c
|
@ -4880,15 +4880,32 @@ getkeystring(char *s, int *len, int how, int *misc)
|
|||
* If the code set isn't handled, we'd better
|
||||
* assume it's US-ASCII rather than just failing
|
||||
* hopelessly. Solaris has a weird habit of
|
||||
* returning 646.
|
||||
* returning 646. This is handled by the
|
||||
* native iconv(), but not by GNU iconv; what's
|
||||
* more, some versions of the native iconv don't
|
||||
* handle standard names like ASCII.
|
||||
*
|
||||
* This should only be a problem if there's a
|
||||
* mismatch between the NLS and the iconv in use,
|
||||
* which probably only means if libiconv is in use.
|
||||
* We checked at configure time if our libraries
|
||||
* pulled in _libiconv_version, which should be
|
||||
* a good test.
|
||||
*
|
||||
* It shouldn't ever be NULL, but while we're
|
||||
* being paranoid...
|
||||
*/
|
||||
if (!codesetstr || !*codesetstr ||
|
||||
!strcmp(codesetstr, "646"))
|
||||
#ifdef ICONV_FROM_LIBICONV
|
||||
if (!codesetstr || !*codesetstr)
|
||||
codesetstr = "US-ASCII";
|
||||
#endif
|
||||
cd = iconv_open(codesetstr, "UCS-4BE");
|
||||
#ifdef ICONV_FROM_LIBICONV
|
||||
if (cd == (iconv_t)-1 && !strcmp(codesetstr, "646")) {
|
||||
codesetstr = "US-ASCII";
|
||||
cd = iconv_open(codesetstr, "UCS-4BE");
|
||||
}
|
||||
#endif
|
||||
if (cd == (iconv_t)-1) {
|
||||
zerr("cannot do charset conversion (iconv failed)");
|
||||
CHARSET_FAILED();
|
||||
|
|
|
@ -824,8 +824,13 @@ if test "x$ac_cv_header_iconv_h" = "xyes"; then
|
|||
[ #include <iconv.h> ])
|
||||
fi
|
||||
fi
|
||||
AH_TEMPLATE([ICONV_FROM_LIBICONV],
|
||||
[Define to 1 if iconv() is linked from libiconv])
|
||||
if test "x$ac_found_iconv" = xyes; then
|
||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
||||
AC_TRY_LINK([#include <iconv.h>],
|
||||
[int myversion = _libiconv_version],
|
||||
AC_DEFINE(ICONV_FROM_LIBICONV), )
|
||||
fi
|
||||
|
||||
dnl Check if iconv uses const in prototype declaration
|
||||
|
|
Loading…
Reference in a new issue