[Rt-commit] r3908 - in rt/branches/QUEBEC-EXPERIMENTAL: . lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Wed Oct 5 14:35:33 EDT 2005


Author: jesse
Date: Wed Oct  5 14:35:32 2005
New Revision: 3908

Modified:
   rt/branches/QUEBEC-EXPERIMENTAL/   (props changed)
   rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Record.pm
Log:
 r17054 at hualien:  jesse | 2005-10-05 10:07:50 -0400
  r15723 at hualien:  jesse | 2005-09-13 12:05:40 -0400
  * When pulling data out of the database, we need to be more careful
    about whether it's utf8 or not. Thanks to Ruslan Zakirov
  
 


Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Record.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Record.pm	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Record.pm	Wed Oct  5 14:35:32 2005
@@ -670,7 +670,14 @@
 
     return('') if ( !defined($value) || $value eq '');
 
-    return Encode::decode_utf8($value) || $value if $args{'decode_utf8'};
+    if( $args{'decode_utf8'} ) {
+    	# XXX: is_utf8 check should be here unless Encode bug would be fixed
+        # see http://rt.cpan.org/NoAuth/Bug.html?id=14559 
+        return Encode::decode_utf8($value) unless Encode::is_utf8($value);
+    } else {
+        # check is_utf8 here just to be shure
+        return Encode::encode_utf8($value) if Encode::is_utf8($value);
+    }
     return $value;
 }
 


More information about the Rt-commit mailing list