develooper Front page | perl.perl5.porters | Postings from August 2008

Re-gaining 'O's

Thread Next
From:
H.Merijn Brand
Date:
August 25, 2008 02:06
Subject:
Re-gaining 'O's
Message ID:
20080825110616.66455fd0@pc09.procura.nl
Since very long we get 'F' or 'X' for things that shouldn't be that
hard to fix for someone who understands how parse_from_file () deals
with UTF-8. Let's regain the 'O's so 'F' and 'X' make sense again.

Below also includes a patch that makes all tests pass, but it feels
wrong.

perl-current/t 137 > cat manopt.pl
#!/pro/bin/perl

use strict;
use warnings;

sub tests
{
    foreach my $l ("C", "en_US.utf8") {
        $ENV{LANG} = $ENV{LC_ALL} = $l;
        print STDERR "TEST for PERL_UNICODE=", $ENV{PERL_UNICODE}//"--undef--",
            " LANG=$l\n";
        system "./perl -I../lib ../lib/Pod/t/man-options.t";
        }
    } # tests

delete $ENV{PERL_UNICODE};
tests;
$ENV{PERL_UNICODE} = "";
tests;
perl-current/t 138 > perl manopt.pl
TEST for PERL_UNICODE=--undef-- LANG=C
1..7
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
TEST for PERL_UNICODE=--undef-- LANG=en_US.utf8
1..7
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
TEST for PERL_UNICODE= LANG=C
1..7
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
TEST for PERL_UNICODE= LANG=en_US.utf8
1..7
ok 1
ok 2
not ok 3
Expected
========
.SH "BEYONCÃ"
.IX Header "BEYONCÃ"
Beyoncé!  Beyoncé!  Beyoncé!!
.PP
.Vb 3
\&    Beyoncé!  Beyoncé!
\&      Beyoncé!  Beyoncé!
\&        Beyoncé!  Beyoncé!
.Ve
.PP
Older versions did not convert Beyoncé in verbatim.

Output
======
.SH "BEYONCÃÂ"
.IX Header "BEYONCÃÂ"
Beyoncé!  Beyoncé!  Beyoncé!!
.PP
.Vb 3
\&    Beyoncé!  Beyoncé!
\&      Beyoncé!  Beyoncé!
\&        Beyoncé!  Beyoncé!
.Ve
.PP
Older versions did not convert Beyoncé in verbatim.

ok 4
ok 5
ok 6
ok 7

I could make them all pass with this, but it `feels' wrong to fix double encoding

--- ../lib/Pod/t/man-options.t.org      2008-08-25 10:35:31.000000000 +0200
+++ ../lib/Pod/t/man-options.t  2008-08-25 11:03:48.000000000 +0200
@@ -73,6 +73,9 @@ while (<DATA>) {
         last if $_ eq "###\n";
         $expected .= $_;
     }
+    utf8::decode ($output);
+    utf8::decode ($output);
+    utf8::decode ($expected);
     if ($output eq $expected) {
         print "ok $n\n";
     } else {

perl-current/t 174 > perl manopt.pl
############################################################
############################################################
############################################################
############################################################
############################################################
TEST for PERL_UNICODE=--undef-- LANG=C
1..7
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
TEST for PERL_UNICODE=--undef-- LANG=en_US.utf8
1..7
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
TEST for PERL_UNICODE= LANG=C
1..7
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
TEST for PERL_UNICODE= LANG=en_US.utf8
1..7
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7


-- 
H.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Next


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