[Jifty-commit] r732 -

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Mar 21 20:23:59 EST 2006


Author: jesse
Date: Tue Mar 21 20:23:58 2006
New Revision: 732

Modified:
   /   (props changed)
   jifty/trunk/lib/Jifty/MasonHandler.pm
   jifty/trunk/lib/Jifty/Record.pm
   jifty/trunk/lib/Jifty/Request.pm

Log:
 r30277 at truegrounds:  jesse | 2006-03-21 20:23:50 -0500
 * UTF8 fixes from Audrey Tang


Modified: jifty/trunk/lib/Jifty/MasonHandler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/MasonHandler.pm	(original)
+++ jifty/trunk/lib/Jifty/MasonHandler.pm	Tue Mar 21 20:23:58 2006
@@ -82,7 +82,12 @@
 
     if ($r->content_type =~ /charset=([\w-]+)$/ ) {
         my $enc = $1;
-        binmode *STDOUT, ":encoding($enc)";
+	if (lc($enc) =~ /utf-?8/) {
+            binmode *STDOUT, ":utf8";
+	}
+	else {
+            binmode *STDOUT, ":encoding($enc)";
+	}
     }
 
     unless ($r->http_header_sent or not $m->auto_send_headers) {

Modified: jifty/trunk/lib/Jifty/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Record.pm	Tue Mar 21 20:23:58 2006
@@ -234,12 +234,9 @@
     }
     my $value = $self->SUPER::_value( $column => @_ );
     return $value if ref $value or $self->column($column)->type eq 'blob';
-    return Encode::decode_utf8($value);
-#   This is the "Right' way to do things according to audrey, but it breaks
-#    
-#    my $value = $self->SUPER::_value(@_);
-#    utf8::upgrade($value) if defined $value;
-#    $value;
+
+    utf8::decode($value) if defined $value;
+    $value;
 }
 
 

Modified: jifty/trunk/lib/Jifty/Request.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Request.pm	(original)
+++ jifty/trunk/lib/Jifty/Request.pm	Tue Mar 21 20:23:58 2006
@@ -266,7 +266,17 @@
             $self->add_state_variable(key => $1, value => $value);
         }
     }
-    return $self->arguments->{$key};
+
+    defined(my $val = $self->arguments->{$key}) or return undef;
+
+    if (ref $val eq 'ARRAY') {
+        utf8::decode($_) for @$val;
+    }
+    else {
+        utf8::decode($val);
+    }
+
+    $val;
 }
 
 =head2 delete KEY


More information about the Jifty-commit mailing list