zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug#254801: zsh: iconv code set completion case insensitivity
       [not found] <20040616184219.GA7569@larve.net>
@ 2004-06-16 23:52 ` Clint Adams
  2004-06-17 13:03   ` Oliver Kiddle
  0 siblings, 1 reply; 10+ messages in thread
From: Clint Adams @ 2004-06-16 23:52 UTC (permalink / raw)
  To: zsh-workers; +Cc: Hugo Haas, 254801-forwarded

> The code set completion for iconv is case sensitive: ISO-<tab> shows
> possibilities, while iso-<tab> doesn't.
> 
> However, iconv doesn't matter about the case of the character encoding
> name given, which is legit AFAIK.
> 
> Is it possible to make the completion case insensitive too?

It's possible.  Does it make sense to do it for all platforms, or is
there an iconv out there that cares about case?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Bug#254801: zsh: iconv code set completion case insensitivity
  2004-06-16 23:52 ` Bug#254801: zsh: iconv code set completion case insensitivity Clint Adams
@ 2004-06-17 13:03   ` Oliver Kiddle
  2004-06-17 14:02     ` Clint Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Oliver Kiddle @ 2004-06-17 13:03 UTC (permalink / raw)
  To: zsh-workers; +Cc: Hugo Haas, 254801-forwarded

Clint wrote:
> > 
> > However, iconv doesn't matter about the case of the character encoding
> > name given, which is legit AFAIK.
> > 
> > Is it possible to make the completion case insensitive too?
> 
> It's possible.  Does it make sense to do it for all platforms, or is
> there an iconv out there that cares about case?

As far as I can tell, it is only GNU iconv which doesn't care about
case. Anyway, it's easy to fix. This patch also makes it use
_call_program and does the job of using LOCPATH on OSF properly.

Oliver

Index: _iconv
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_iconv,v
retrieving revision 1.3
diff -u -r1.3 _iconv
--- _iconv	12 Mar 2003 18:55:38 -0000	1.3
+++ _iconv	17 Jun 2004 12:30:19 -0000
@@ -1,6 +1,7 @@
 #compdef iconv
 
-local expl curcontext="$curcontext" state line codeset LOCPATH ret=1
+local expl curcontext="$curcontext" state line codeset ret=1
+local LOCPATH="${LOCPATH:-/usr/lib/nls/loc}"
 
 if _pick_variant gnu=GNU unix --version; then
 
@@ -22,8 +23,9 @@
       if compset -P '*/'; then
         _wanted option expl option compadd "$@" /TRANSLIT && ret=0
       else
-	_wanted codesets expl 'code set' compadd "$@" -M 'r:|-=* r:|=*' \
-	    ${${${(f)"$(iconv --list|sed -n '/^$/,$ p')"}## #}%//} && ret=0
+	_wanted codesets expl 'code set' compadd "$@" \
+	    -M 'm:{a-zA-Z}={A-Za-z} r:|-=* r:|=*' \
+	    ${${${(f)"$(_call_program codesets iconv --list|sed -n '/^$/,$ p')"}## #}%//} && ret=0
       fi
     fi
     
@@ -38,7 +40,7 @@
     if [[ $state = codeset ]]; then
       if [[ -f /usr/lib/iconv/iconv_data ]]; then  # IRIX & Solaris
 	codeset=( ${${(f)"$(</usr/lib/iconv/iconv_data)"}%%[[:blank:]]*} )
-      elif [[ -d ${LOCPATH:=/usr/lib/nls/loc}/iconv ]]; then  # OSF
+      elif [[ -d $LOCPATH/iconv ]]; then  # OSF
 	codeset=( $LOCPATH/iconv/*(N:t) )
 	codeset=( ${(j:_:s:_:)codeset} )
       else


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Bug#254801: zsh: iconv code set completion case insensitivity
  2004-06-17 13:03   ` Oliver Kiddle
@ 2004-06-17 14:02     ` Clint Adams
  2004-06-17 14:04       ` Clint Adams
  2004-06-17 14:43       ` Oliver Kiddle
  0 siblings, 2 replies; 10+ messages in thread
From: Clint Adams @ 2004-06-17 14:02 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers, Hugo Haas, 254801

> As far as I can tell, it is only GNU iconv which doesn't care about
> case. Anyway, it's easy to fix. This patch also makes it use

iconv from Solaris 8 and 9 doesn't care either.  I can't get it to work
at all on Solaris 7, regardless of case, so I don't know what the answer
there is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Bug#254801: zsh: iconv code set completion case insensitivity
  2004-06-17 14:02     ` Clint Adams
@ 2004-06-17 14:04       ` Clint Adams
  2004-06-17 14:43       ` Oliver Kiddle
  1 sibling, 0 replies; 10+ messages in thread
From: Clint Adams @ 2004-06-17 14:04 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers, Hugo Haas, 254801

> iconv from Solaris 8 and 9 doesn't care either.  I can't get it to work
> at all on Solaris 7, regardless of case, so I don't know what the answer
> there is.

Oh, and here's the output of iconv -l from a Solaris 9 machine (it doesn't
understand --list)

ANSI_X3.4-1968 ANSI_X3.4-1986 ASCII CP367 IBM367 ISO-IR-6 ISO646-US
ISO_646.IRV:1991 US US-ASCII CSASCII
UTF-8
ISO-10646-UCS-2 UCS-2 CSUNICODE
UCS-2BE UNICODE-1-1 UNICODEBIG CSUNICODE11
UCS-2LE UNICODELITTLE
ISO-10646-UCS-4 UCS-4 CSUCS4
UCS-4BE
UCS-4LE
UTF-16
UTF-16BE
UTF-16LE
UTF-32
UTF-32BE
UTF-32LE
UNICODE-1-1-UTF-7 UTF-7 CSUNICODE11UTF7
UCS-2-INTERNAL
UCS-2-SWAPPED
UCS-4-INTERNAL
UCS-4-SWAPPED
C99
JAVA
CP819 IBM819 ISO-8859-1 ISO-IR-100 ISO_8859-1 ISO_8859-1:1987 L1 LATIN1
CSISOLATIN1
ISO-8859-2 ISO-IR-101 ISO_8859-2 ISO_8859-2:1987 L2 LATIN2 CSISOLATIN2
ISO-8859-3 ISO-IR-109 ISO_8859-3 ISO_8859-3:1988 L3 LATIN3 CSISOLATIN3
ISO-8859-4 ISO-IR-110 ISO_8859-4 ISO_8859-4:1988 L4 LATIN4 CSISOLATIN4
CYRILLIC ISO-8859-5 ISO-IR-144 ISO_8859-5 ISO_8859-5:1988
CSISOLATINCYRILLIC
ARABIC ASMO-708 ECMA-114 ISO-8859-6 ISO-IR-127 ISO_8859-6
ISO_8859-6:1987 CSISOLATINARABIC
ECMA-118 ELOT_928 GREEK GREEK8 ISO-8859-7 ISO-IR-126 ISO_8859-7
ISO_8859-7:1987 CSISOLATINGREEK
HEBREW ISO-8859-8 ISO-IR-138 ISO_8859-8 ISO_8859-8:1988 CSISOLATINHEBREW
ISO-8859-9 ISO-IR-148 ISO_8859-9 ISO_8859-9:1989 L5 LATIN5 CSISOLATIN5
ISO-8859-10 ISO-IR-157 ISO_8859-10 ISO_8859-10:1992 L6 LATIN6
CSISOLATIN6
ISO-8859-13 ISO-IR-179 ISO_8859-13 L7 LATIN7
ISO-8859-14 ISO-CELTIC ISO-IR-199 ISO_8859-14 ISO_8859-14:1998 L8 LATIN8
ISO-8859-15 ISO-IR-203 ISO_8859-15 ISO_8859-15:1998
ISO-8859-16 ISO-IR-226 ISO_8859-16 ISO_8859-16:2000
KOI8-R CSKOI8R
KOI8-U
KOI8-RU
CP1250 MS-EE WINDOWS-1250
CP1251 MS-CYRL WINDOWS-1251
CP1252 MS-ANSI WINDOWS-1252
CP1253 MS-GREEK WINDOWS-1253
CP1254 MS-TURK WINDOWS-1254
CP1255 MS-HEBR WINDOWS-1255
CP1256 MS-ARAB WINDOWS-1256
CP1257 WINBALTRIM WINDOWS-1257
CP1258 WINDOWS-1258
850 CP850 IBM850 CSPC850MULTILINGUAL
862 CP862 IBM862 CSPC862LATINHEBREW
866 CP866 IBM866 CSIBM866
MAC MACINTOSH MACROMAN CSMACINTOSH
MACCENTRALEUROPE
MACICELAND
MACCROATIAN
MACROMANIA
MACCYRILLIC
MACUKRAINE
MACGREEK
MACTURKISH
MACHEBREW
MACARABIC
MACTHAI
HP-ROMAN8 R8 ROMAN8 CSHPROMAN8
NEXTSTEP
ARMSCII-8
GEORGIAN-ACADEMY
GEORGIAN-PS
KOI8-T
MULELAO-1
CP1133 IBM-CP1133
ISO-IR-166 TIS-620 TIS620 TIS620-0 TIS620.2529-1 TIS620.2533-0
TIS620.2533-1
CP874 WINDOWS-874
VISCII VISCII1.1-1 CSVISCII
TCVN TCVN-5712 TCVN5712-1 TCVN5712-1:1993
ISO-IR-14 ISO646-JP JIS_C6220-1969-RO JP CSISO14JISC6220RO
JISX0201-1976 JIS_X0201 X0201 CSHALFWIDTHKATAKANA
ISO-IR-87 JIS0208 JIS_C6226-1983 JIS_X0208 JIS_X0208-1983 JIS_X0208-1990
X0208 CSISO87JISX0208
ISO-IR-159 JIS_X0212 JIS_X0212-1990 JIS_X0212.1990-0 X0212
CSISO159JISX02121990
CN GB_1988-80 ISO-IR-57 ISO646-CN CSISO57GB1988
CHINESE GB_2312-80 ISO-IR-58 CSISO58GB231280
CN-GB-ISOIR165 ISO-IR-165
ISO-IR-149 KOREAN KSC_5601 KS_C_5601-1987 KS_C_5601-1989 CSKSC56011987
EUC-JP EUCJP EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE
CSEUCPKDFMTJAPANESE
MS_KANJI SHIFT-JIS SHIFT_JIS SJIS CSSHIFTJIS
CP932
ISO-2022-JP CSISO2022JP
ISO-2022-JP-1
ISO-2022-JP-2 CSISO2022JP2
CN-GB EUC-CN EUCCN GB2312 CSGB2312
CP936 GBK
GB18030
ISO-2022-CN CSISO2022CN
ISO-2022-CN-EXT
HZ HZ-GB-2312
EUC-TW EUCTW CSEUCTW
BIG-5 BIG-FIVE BIG5 BIGFIVE CN-BIG5 CSBIG5
CP950
BIG5-HKSCS BIG5HKSCS
EUC-KR EUCKR CSEUCKR
CP949 UHC
CP1361 JOHAB
ISO-2022-KR CSISO2022KR


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Bug#254801: zsh: iconv code set completion case insensitivity
  2004-06-17 14:02     ` Clint Adams
  2004-06-17 14:04       ` Clint Adams
@ 2004-06-17 14:43       ` Oliver Kiddle
  2004-06-17 15:01         ` Clint Adams
  1 sibling, 1 reply; 10+ messages in thread
From: Oliver Kiddle @ 2004-06-17 14:43 UTC (permalink / raw)
  To: zsh-workers; +Cc: Hugo Haas, 254801

Clint Adams wrote:
> iconv from Solaris 8 and 9 doesn't care either.  I can't get it to work
> at all on Solaris 7, regardless of case, so I don't know what the answer
> there is.

It does care on Solaris 8. Or at least this is what I get:
  % iconv -f 646EN -t 8859
  Not supported 646EN to 8859

(lowercase the `en' and it does work).

I don't have access to Solaris 9. Does the current _iconv manage to
complete the codesets on it?

Oliver 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Bug#254801: zsh: iconv code set completion case insensitivity
  2004-06-17 14:43       ` Oliver Kiddle
@ 2004-06-17 15:01         ` Clint Adams
  2004-06-24 20:47           ` Clint Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Clint Adams @ 2004-06-17 15:01 UTC (permalink / raw)
  To: Oliver Kiddle, 254801; +Cc: zsh-workers

> It does care on Solaris 8. Or at least this is what I get:
>   % iconv -f 646EN -t 8859
>   Not supported 646EN to 8859
> 
> (lowercase the `en' and it does work).

Odd.

% iconv -f 646EN -t 8859
iconv: conversion from 646EN unsupported
% iconv -f 646en -t 8859
iconv: conversion from 646en unsupported
% echo blah | iconv -f macromania -t UTF-8 
blah
% echo blah | iconv -f MACROMANIA -t UTF-8          
blah
% echo blah | iconv -f MACROMANIA -t utf-8
blah
% echo blah | iconv -f MaCRoMaNia -t utf-8 
blah

> I don't have access to Solaris 9. Does the current _iconv manage to
> complete the codesets on it?

It doesn't with 4.1.1.  I'll try current in a bit.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Bug#254801: zsh: iconv code set completion case insensitivity
  2004-06-17 15:01         ` Clint Adams
@ 2004-06-24 20:47           ` Clint Adams
  2004-06-25  9:39             ` Oliver Kiddle
  0 siblings, 1 reply; 10+ messages in thread
From: Clint Adams @ 2004-06-24 20:47 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers

> It doesn't with 4.1.1.  I'll try current in a bit.

% iconv -f <TAB>Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...]
or:    iconv -l
Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...]
or:    iconv -l
Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...]
or:    iconv -l
Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...]
or:    iconv -l
        iconv -f
	Completing `code set'


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Bug#254801: zsh: iconv code set completion case insensitivity
  2004-06-24 20:47           ` Clint Adams
@ 2004-06-25  9:39             ` Oliver Kiddle
  2004-06-26 14:37               ` Clint Adams
  2004-06-26 18:12               ` Bart Schaefer
  0 siblings, 2 replies; 10+ messages in thread
From: Oliver Kiddle @ 2004-06-25  9:39 UTC (permalink / raw)
  To: zsh-workers

Clint Adams wrote:
> > It doesn't with 4.1.1.  I'll try current in a bit.
> 
> % iconv -f <TAB>Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...]

I don't quite understand why you got the usage message four times.

Anyway, can you try the following patch.

I've just noticed that the Sourceforge compile farm has Solaris
9 machines but their iconv is identical to that of Solaris 8. So we
probably need to just try running iconv -l.

Does /usr/lib/iconv/iconv_data exist? What are the -c and -s options -
the same as GNU iconv's?

Oliver

Index: Completion/Unix/Command/_iconv
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_iconv,v
retrieving revision 1.4
diff -u -r1.4 _iconv
--- Completion/Unix/Command/_iconv	17 Jun 2004 13:12:26 -0000	1.4
+++ Completion/Unix/Command/_iconv	25 Jun 2004 09:26:07 -0000
@@ -1,9 +1,10 @@
 #compdef iconv
 
 local expl curcontext="$curcontext" state line codeset ret=1
+local -a args
 local LOCPATH="${LOCPATH:-/usr/lib/nls/loc}"
 
-if _pick_variant gnu=GNU unix --version; then
+if _pick_variant gnu=GNU unix --version 2>/dev/null; then
 
   local exargs="--list -? --help --usage --version -V"
   _arguments -C -S -s \
@@ -31,14 +32,18 @@
 
   return ret
 else
-
-  _arguments -C \
-    '-f[specify code set of input file]:code set:->codeset' \
-    '-t[specify code set for output]:code set:->codeset' \
-    '1:file:_files' && return 0
+  [[ $OSTYPE = solaris2.9 ]] &&
+      args=( '(-l)'{-c,-s} '(- 1)-l[list available code sets]' )
+  
+  _arguments -C $args \
+    '(-l)-f[specify code set of input file]:code set:->codeset' \
+    '(-l)-t[specify code set for output]:code set:->codeset' \
+    '(-l)1:file:_files' && return 0
 
   if [[ $state = codeset ]]; then
-    if [[ -f /usr/lib/iconv/iconv_data ]]; then  # IRIX & Solaris
+    if [[ $OSTYPE = solaris2.9 ]]; then
+      codeset=( $(_call_program codesets iconv -l) )
+    elif [[ -f /usr/lib/iconv/iconv_data ]]; then  # IRIX & Solaris
       codeset=( ${${(f)"$(</usr/lib/iconv/iconv_data)"}%%[[:blank:]]*} )
     elif [[ -d $LOCPATH/iconv ]]; then  # OSF
       codeset=( $LOCPATH/iconv/*(N:t) )


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Bug#254801: zsh: iconv code set completion case insensitivity
  2004-06-25  9:39             ` Oliver Kiddle
@ 2004-06-26 14:37               ` Clint Adams
  2004-06-26 18:12               ` Bart Schaefer
  1 sibling, 0 replies; 10+ messages in thread
From: Clint Adams @ 2004-06-26 14:37 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers

> Anyway, can you try the following patch.
> 
> I've just noticed that the Sourceforge compile farm has Solaris
> 9 machines but their iconv is identical to that of Solaris 8. So we
> probably need to just try running iconv -l.
> 
> Does /usr/lib/iconv/iconv_data exist? What are the -c and -s options -
> the same as GNU iconv's?

Yes, it exists.  The -c and -s options are indeed the same as GNU
iconv's, primarily due to GNU iconv (1.8?) being first in my PATH
on this machine.  I apologize for the confusion due to not noticing
this.

It does understand -l, but not --list.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Bug#254801: zsh: iconv code set completion case insensitivity
  2004-06-25  9:39             ` Oliver Kiddle
  2004-06-26 14:37               ` Clint Adams
@ 2004-06-26 18:12               ` Bart Schaefer
  1 sibling, 0 replies; 10+ messages in thread
From: Bart Schaefer @ 2004-06-26 18:12 UTC (permalink / raw)
  To: zsh-workers

On Fri, 25 Jun 2004, Oliver Kiddle wrote:

> I don't quite understand why you got the usage message four times.

Depending on the value of the completer style and whether or not caching 
is used, the functions to generate matches may be called up to once per
completer named in the style.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-06-27 10:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20040616184219.GA7569@larve.net>
2004-06-16 23:52 ` Bug#254801: zsh: iconv code set completion case insensitivity Clint Adams
2004-06-17 13:03   ` Oliver Kiddle
2004-06-17 14:02     ` Clint Adams
2004-06-17 14:04       ` Clint Adams
2004-06-17 14:43       ` Oliver Kiddle
2004-06-17 15:01         ` Clint Adams
2004-06-24 20:47           ` Clint Adams
2004-06-25  9:39             ` Oliver Kiddle
2004-06-26 14:37               ` Clint Adams
2004-06-26 18:12               ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).