mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-27 06:11:06 +02:00
20921: using UCS-4BE instead of ISO-10646 to identify character encoding
is more portable, find more encodings in iconv completion on Solaris 20924: make error message more specific
This commit is contained in:
parent
eb82327576
commit
1b50dff802
3 changed files with 11 additions and 4 deletions
|
@ -1,5 +1,10 @@
|
|||
2005-03-03 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 20921, 20924: Src/utils.c, Completion/Unix/Command/_iconv:
|
||||
using UCS-4BE instead of ISO-10646 to identify character
|
||||
encoding is more portable; make error message more specific;
|
||||
find more encodings in iconv completion on Solaris
|
||||
|
||||
* Henryk Konsek: 20918 (modified): Completion/Unix/Command/_unace:
|
||||
new completion for unace
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#compdef iconv
|
||||
|
||||
local expl curcontext="$curcontext" state line codeset ret=1
|
||||
local expl curcontext="$curcontext" state line ret=1
|
||||
local LOCPATH="${LOCPATH:-/usr/lib/nls/loc}"
|
||||
local -U codeset
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
|
||||
|
@ -40,6 +41,7 @@ else
|
|||
if [[ $state = codeset ]]; then
|
||||
if [[ -f /usr/lib/iconv/iconv_data ]]; then # IRIX & Solaris
|
||||
codeset=( ${${(f)"$(</usr/lib/iconv/iconv_data)"}%%[[:blank:]]*} )
|
||||
codeset+=( /usr/lib/iconv/*%*.so(Ne.'reply=( ${${REPLY:t}%%%*} ${${REPLY:r}#*%} )'.) )
|
||||
elif [[ -d $LOCPATH/iconv ]]; then # OSF
|
||||
codeset=( $LOCPATH/iconv/*(N:t) )
|
||||
codeset=( ${(j:_:s:_:)codeset} )
|
||||
|
|
|
@ -3617,13 +3617,13 @@ getkeystring(char *s, int *len, int fromwhere, int *misc)
|
|||
ICONV_CONST char *inptr = inbuf;
|
||||
inbytes = 4;
|
||||
outbytes = 6;
|
||||
/* assume big endian convention for UCS-4 */
|
||||
/* store value in big endian form */
|
||||
for (i=3;i>=0;i--) {
|
||||
inbuf[i] = wval & 0xff;
|
||||
wval >>= 8;
|
||||
}
|
||||
|
||||
cd = iconv_open(nl_langinfo(CODESET), "ISO-10646");
|
||||
cd = iconv_open(nl_langinfo(CODESET), "UCS-4BE");
|
||||
if (cd == (iconv_t)-1) {
|
||||
zerr("cannot do charset conversion", NULL, 0);
|
||||
if (fromwhere == 4) {
|
||||
|
@ -3637,7 +3637,7 @@ getkeystring(char *s, int *len, int fromwhere, int *misc)
|
|||
count = iconv(cd, &inptr, &inbytes, &t, &outbytes);
|
||||
iconv_close(cd);
|
||||
if (count == (size_t)-1) {
|
||||
zerr("cannot do charset conversion", NULL, 0);
|
||||
zerr("character not in range", NULL, 0);
|
||||
*t = '\0';
|
||||
*len = t - buf;
|
||||
return buf;
|
||||
|
|
Loading…
Reference in a new issue