From: Jarkko Hietaniemi Date: Mon, 8 Apr 2002 22:05:08 +0000 (+0000) Subject: Small piconv tweaks (sent to Dan). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ce912cd45a37045ac510819045053bb9236c3b48;p=p5sagit%2Fp5-mst-13.2.git Small piconv tweaks (sent to Dan). p4raw-id: //depot/perl@15815 --- diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index a828d46..0e89009 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -57,7 +57,8 @@ sub encodings } my %modules = map {$_ => 1} @modules; return - sort grep {!/^(?:Internal|Unicode)$/o} keys %Encoding; + sort { lc $a cmp lc $b } + grep {!/^(?:Internal|Unicode)$/o} keys %Encoding; } sub define_encoding diff --git a/ext/Encode/bin/piconv b/ext/Encode/bin/piconv index 10cfb5e..c375e19 100644 --- a/ext/Encode/bin/piconv +++ b/ext/Encode/bin/piconv @@ -22,7 +22,7 @@ my $scheme = exists $Scheme{$Opt{S}} ? $Opt{S} : 'from_to'; if ($Opt{D}){ my $cfrom = Encode->getEncoding($from)->name; my $cto = Encode->getEncoding($to)->name; - print STDERR <<"EOT"; + print <<"EOT"; Scheme: $scheme From: $from => $cfrom To: $to => $cto @@ -51,7 +51,7 @@ if ($scheme eq 'from_to'){ } sub list_encodings{ - print STDERR join("\n", Encode->encodings(":all")), "\n"; + print join("\n", Encode->encodings(":all")), "\n"; exit; } @@ -63,7 +63,7 @@ sub help{ print STDERR <<"EOT"; $name [-f from_encoding] [-t to_encoding] [-s string] [files...] $name -l - -l lists all available encodings. + -l lists all available encodings (the canonical names, many aliases exist) -f from_encoding When omitted, the current locale will be used. -t to_encoding When omitted, the current locale will be used. -s string "string" will be converted instead of STDIN. @@ -114,7 +114,12 @@ uses I instead of file for the source of text. Same as F. =item -l -Lists all available encodings to STDERR. +Lists all available encodings, one per line, in case-insensitive +order. Note that only the canonical names are listed, many aliases +exist. For example, the names are case-insensitive, and many standard +and common aliases work, like "latin1" for "ISO 8859-1", or "ibm850" +instead of "cp850", or "winlatin1" for "cp1252". See L +for the full discussion. =item -h @@ -155,6 +160,8 @@ Like I<-D> option, this is also for Encode hackers. L L L +L +L L =cut diff --git a/ext/Encode/lib/Encode/Alias.pm b/ext/Encode/lib/Encode/Alias.pm index dd7012f..0c4b884 100644 --- a/ext/Encode/lib/Encode/Alias.pm +++ b/ext/Encode/lib/Encode/Alias.pm @@ -243,7 +243,7 @@ __END__ =head1 NAME -Encode::Alias - alias defintions to encodings +Encode::Alias - alias definitions to encodings =head1 SYNOPSIS