develooper Front page | perl.perl5.porters | Postings from June 2011

Re: really no way to list supported encoding?

Thread Previous
From:
H.Merijn Brand
Date:
June 12, 2011 09:30
Subject:
Re: really no way to list supported encoding?
Message ID:
20110612182934.750c6763@pc09.procura.nl
On Sun, 12 Jun 2011 15:39:27 +0100, Aaron Crane <perl@aaroncrane.co.uk>
wrote:

> Tom Christiansen <tchrist@perl.com> wrote:
> > I feel as though I'm missing something obvious, so would someone please
> > be so kind as to tell me what that is?
> 
> perl -MEncode -wE 'say for Encode->encodings(":all")'
> 
> Documented in the perldoc for Encode; grep for "list".

You might want to filter out m/^mime/i

    my $uc = shift;
    foreach my $e (grep { !m/^mime/i } Encode->encodings (":all")) {
	my $x = encode ("utf8", $uc);
	from_to ($x, "utf8", $e);
	$x eq "?" && $uc ne "?" and next;
	printf "  %-30s %-10s", $e, unpack "H*", $x;
	print  "  ", map { sprintf "\\%03o", hex $_ } unpack "(A2)*", unpack "H*", $x if $opt_o;
	print  "\n"
	}

$ uchar -e ł
ł U00142 \N{LATIN SMALL LETTER L WITH STROKE}

  7bit-jis                       1b24284429481b2842
  AdobeStandardEncoding          f8
  cp1026                         6f
  cp1047                         6f
  cp1250                         b3
  cp1257                         f9
  cp37                           6f
  cp424                          6f
  cp500                          6f
  cp775                          88
  cp852                          88
  cp875                          6f
  cp949                          a9a9
  euc-jp                         8fa9c8
  euc-kr                         a9a9
  gb12345-raw                    22
  gb2312-raw                     22
  hz                             22
  iso-2022-jp                    1b2428443f3f1b2842
  iso-2022-jp-1                  1b24284429481b2842
  iso-2022-kr                    1b2429430e29290f
  iso-8859-13                    f9
  iso-8859-16                    b3
  iso-8859-2                     b3
  iso-ir-165                     22
  jis0208-raw                    20
  jis0212-raw                    2948
  johab                          dd39
  ksc5601-raw                    2929
  MacCentralEurRoman             b8
  MacKorean                      a9a9
  nextstep                       f8
  posix-bc                       6f
  UCS-2BE                        0142
  UCS-2LE                        4201
  UTF-16                         feff0142
  UTF-16BE                       0142
  UTF-16LE                       4201
  UTF-32                         0000feff00000142
  UTF-32BE                       00000142
  UTF-32LE                       42010000
  UTF-7                          2b4155492d
  utf-8-strict                   c582
  utf8                           c582


-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About