I've installed the ru_RU.UTF-8 locale and was able to reproduce the problem. The problem was due to Apache::Util::ht_time returning a UTF-8 string, but perl didn't know it was UTF-8. Adding an explicit
$fmtdate = Encode::decode_utf8($fmtdate);
solves the problem. Here is the committed patch. Please check that it works for you. Thank you, Dmitry.


Index: t/conf/extra.conf.in
===================================================================
RCS file: /home/cvs/modperl-2.0/t/conf/extra.conf.in,v
retrieving revision 1.14
diff -u -r1.14 extra.conf.in
--- t/conf/extra.conf.in        21 Aug 2004 20:13:39 -0000      1.14
+++ t/conf/extra.conf.in        4 Sep 2004 18:06:20 -0000
@@ -84,3 +84,7 @@
     SetHandler modperl
     PerlResponseHandler Apache::Status
 </Location>
+
+# for TestApache::util
+PerlPassEnv LC_CTYPE
+PerlPassEnv LC_TIME
Index: t/response/TestApache/util.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestApache/util.pm,v
retrieving revision 1.7
diff -u -r1.7 util.pm
--- t/response/TestApache/util.pm       25 Aug 2004 19:49:23 -0000      1.7
+++ t/response/TestApache/util.pm       4 Sep 2004 18:06:20 -0000
@@ -5,6 +5,16 @@
 use strict;
 use warnings FATAL => 'all';

+# to fully test this test the following locale settings need to be run:
+#
+# some /^en_/ locale, e.g. /^en_GB*
+# LC_CTYPE=en_GB.UTF-8 LC_TIME=en_GB.UTF-8 t/TEST -verbose apache/util.t
+# LC_CTYPE=en_GB       LC_TIME=en_GB       t/TEST -verbose apache/util.t
+#
+# some non-/^en_/ locale, e.g. ru_RU
+# LC_CTYPE=ru_RU.UTF-8 LC_TIME=ru_RU.UTF-8 t/TEST -verbose apache/util.t
+# LC_CTYPE=ru_RU       LC_TIME=ru_RU       t/TEST -verbose apache/util.t
+
 # regex matching (LC_CTYPE) of strftime-like (LC_TIME) strings
 use locale;

@@ -18,11 +28,11 @@

 use Apache::Const -compile => 'OK';

-# XXX: need to use PerlPassEnv to get these %ENV vars
-my $locale = $ENV{LANG} || $ENV{LC_TIME} || '';
-# XXX: will any en_XXX work with http_parse? try setlocale?
-# XXX: should we set $ENV{LANG} to en_US instead of skipping?
-my $parse_time_ok = $locale =~ /^en_/ ? 1 : 0;
+# those are passed via PerlPassEnv
+my $locale = $ENV{LC_TIME} || '';
+
+my $parse_time_ok  = $locale =~ /^en_/   ? 1 : 0;
+my $locale_is_utf8 = $locale =~ /UTF-8$/ ? 1 : 0;

 sub handler {
     my $r = shift;
@@ -96,6 +106,17 @@
         ok t_cmp $ptime, $time, $comment;
     }
     else {
+        if ($locale_is_utf8) {
+            if (have_min_perl_version(5.008)) {
+                require Encode;
+                # perl doesn't know yet that $fmtdate is a utf8 string
+                $fmtdate = Encode::decode_utf8($fmtdate);
+            }
+            else {
+                skip "Skip UTF-8 locale needs perl 5.8.0+", 0;
+                return;
+            }
+        }
         ok t_cmp $fmtdate, $fmtdate_re, $comment;
     }
 }


-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to