Unicode message length test failure

14 views
Skip to first unread message

John Siracusa

unread,
Nov 17, 2009, 9:30:50 AM11/17/09
to rose-htm...@googlegroups.com
I'm getting a few CPAN tester reports for Rose::HTML::Objects 0.606
that show a test failure on a string length test for a UTF-8 encoded
error message. The error:

# Failed test 'localized error length'
# at t/form-field-l10n.t line 191.
# got: '46'
# expected: '25'
# Looks like you failed 1 test of 43.
t/form-field-l10n.t ...............

The full report:

http://www.nntp.perl.org/group/perl.cpan.testers/2009/11/msg6026258.html

The test in question:

$o = Rose::HTML::Form::Field->new(name => 'test', required => 1);
$o->locale('bg');
$o->validate;

$error = $o->error;
is(length($error), 25, 'localized error length');

Needless to say, this test passes just fine for me in both perl 5.10.0
and 5.8.8. Doe anyone have an idea what could be causing this? Maybe
a LOCALE environment variable? Can anyone else reproduce it?

-John

Michael Lackhoff

unread,
Nov 17, 2009, 1:04:30 PM11/17/09
to rose-htm...@googlegroups.com
On 17.11.2009 15:30 John Siracusa wrote:

> I'm getting a few CPAN tester reports for Rose::HTML::Objects 0.606
> that show a test failure on a string length test for a UTF-8 encoded
> error message. The error:
>
> # Failed test 'localized error length'
> # at t/form-field-l10n.t line 191.
> # got: '46'
> # expected: '25'
> # Looks like you failed 1 test of 43.
> t/form-field-l10n.t ...............

I get the same failure with Perl 5.8.8 on both Ubuntu 8.04 and Windows 2000.

> The full report:
>
> http://www.nntp.perl.org/group/perl.cpan.testers/2009/11/msg6026258.html
>
> The test in question:
>
> $o = Rose::HTML::Form::Field->new(name => 'test', required => 1);
> $o->locale('bg');
> $o->validate;
>
> $error = $o->error;
> is(length($error), 25, 'localized error length');
>
> Needless to say, this test passes just fine for me in both perl 5.10.0
> and 5.8.8. Doe anyone have an idea what could be causing this? Maybe
> a LOCALE environment variable? Can anyone else reproduce it?

Neither tested systems has a LOCALE environment variable set.
Ubuntu is in English, Windows German.
Anything I can check to further nail this down?

-Michael

karpet

unread,
Nov 19, 2009, 10:10:43 AM11/19/09
to Rose::HTML::Objects


On Nov 17, 8:30 am, John Siracusa <sirac...@gmail.com> wrote:
> I'm getting a few CPAN tester reports for Rose::HTML::Objects 0.606
> that show a test failure on a string length test for a UTF-8 encoded
> error message.  The error:
>
> #   Failed test 'localized error length'
> #   at t/form-field-l10n.t line 191.
> #          got: '46'
> #     expected: '25'
> # Looks like you failed 1 test of 43.
> t/form-field-l10n.t ...............
>

fwiw, I've seen behaviour similar to that when a UTF-8 encoded string
is interpreted as Latin1 by the Perl compiler, and I've had to
explicitly set the utf8 flag on the scalar.
Reply all
Reply to author
Forward
0 new messages