tyatpi has asked for the wisdom of the Perl Monks concerning the following question:
And now I test it with:sub beautify { my ($in) = @_; my $tmp; foreach (split(/\s/o, lc($in))){ $tmp .= ucfirst($_); $tmp .= ' '; } $tmp =~ s/\s$//; return($tmp); }
They are all failing. I've tried with:use util; use Test::More tests => 34; is( &util::beautify( "àisTheWord"), "Àistheword", "àisTheWord - specia +l character changes case." ); ... is( &util::beautify( "ùisTheWord"), "Ùistheword", "ùisTheWord - specia +l character changes case." ); is( &util::beautify( "ûisTheWord"), "Ûistheword", "ûisTheWord - specia +l character changes case." ); is( &util::beautify( "üisTheWord"), "Üistheword", "üisTheWord - specia +l character changes case." ); is( &util::beautify( "ÿisTheWord"), "Ÿisthejword", "ÿisTheWord - speci +al character changes case." ); ...
and all subsets of that pair, but to no avail. The system is perl v5.8.8, and when I run the tests on my v5.10 home laptop without any modifications to the original util.pm file, all tests pass! Any insights on how to debug would be very very helpful.use utf8; use Encode;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UTF8 - ucfirst() is not working with foreign characters
by graff (Chancellor) on Jan 11, 2012 at 06:28 UTC | |
by mje (Curate) on Jan 11, 2012 at 09:25 UTC | |
|
Re: UTF8 - ucfirst() is not working with foreign characters
by 3dbc (Monk) on Jan 11, 2012 at 04:07 UTC | |
|
Re: UTF8 - ucfirst() is not working with foreign characters
by Khen1950fx (Canon) on Jan 11, 2012 at 06:23 UTC |