develooper Front page | perl.perl5.porters | Postings from October 2005

Re: Transliteration operator(tr//)on EBCDIC platform

Thread Previous | Thread Next
October 1, 2005 18:05
Re: Transliteration operator(tr//)on EBCDIC platform
Message ID:

On Fri, 30 Sep 2005 14:13:46 +0530, Sastry <> wrote
> Hi Sadahiro
> The two test cases that were failing get passed if I use the
> , but surprisingly there are other two test cases that are failing now
> They are
> a)
> ($a = v300.196.172.300.196.172.400.198.144) =~
> 	tr/\xac\xc4\x{12c}\x{190}/\xad\x{12d}\xc5\x{191}/;
> is($a, v197.301.173.197.301.173.401.198.144,    'all together now!');
> b)
> ($a = "\xfc\xfd\xfe\xff\x{100}") =~ tr/\x{1000}\x00-\xff/X/c;
> is($a, "\xfc\xfd\xfe\xffX");
> The verbose output after enabling the DEBUG statements is
> -------------------------------------------------------------------------------------------------
> SWASHNEW utf8  # comment
> 00d6		005b
> 0044		012d
> 012c		0045
> 0190		0191

According to your info, this output should corresponds to

As \xac in EBCDIC CP-1047 corresponds to U+00D0 but not U+00D6,
the first column of the first line should be 00d0 but not 00d6.
I don't know why so. If it was \xec instead of \xac, 00d6 could
be reasonable.

> SWASHNEW utf8  # comment
> 0100		0058
> 0101	0fff	XXXX
> 1001	7fffffff	XXXX
>  8 89

According to your info, this output should corresponds to
The output from SWASHNEW for this is as expected.
It is remarkable that this test is to be newly added.

If the patch is guilty, the perl without the patch should pass
the following test where no character range is used.
If the perl *without* the patch does not pass the test,
perl may have retained another/other snags elsewhere.

($a = "\xfc\xfd\xfe\xff\x{100}") =~ tr/\x{1000}\xfc\xfd\xfe\xff/X/c;
is($a, "\xfc\xfd\xfe\xffX");

> Please see if there can be a generic change which does not effect the
> other tests!

If you want "no failure" rather than "progress", the "best" fix
is just to skip the failing test (not as "todo").
It is very reasonable because perlop.pod clearly mentions that
character ranges are unportable except the range begins from and
ends at either alphabets of equal case (a-e, A-E), or digits (0-4).


diff -ur perl~/t/op/tr.t perl/t/op/tr.t
--- perl~/t/op/tr.t	Thu Aug 18 18:27:25 2005
+++ perl/t/op/tr.t	Sun Oct 02 09:37:13 2005
@@ -259,13 +259,15 @@
 # UTF8 range tests from Inaba Hiroto
+SKIP: {
+    skip "EBCDIC", 2 if $Is_EBCDIC;
 # Not working in EBCDIC as of 12674.
 ($a = v300.196.172.302.197.172) =~ tr/\x{12c}-\x{130}/\xc0-\xc4/;
 is($a, v192.,    'UTF range');
 ($a = v300.196.172.302.197.172) =~ tr/\xc4-\xc8/\x{12c}-\x{130}/;
 is($a, v300.300.172.302.301.172);
 # UTF8 range tests from Karsten Sperling (patch #9008 required)

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About