[Rt-commit] r3927 - in rt/branches/3.5-TESTING: . lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Wed Oct 5 15:24:11 EDT 2005


Author: jesse
Date: Wed Oct  5 15:24:11 2005
New Revision: 3927

Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/lib/RT/Record.pm
Log:
 r17085 at hualien:  jesse | 2005-10-05 11:08:57 -0400
  r17068 at hualien:  jesse | 2005-10-05 10:39:19 -0400
   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/3.5-TESTING/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Record.pm	(original)
+++ rt/branches/3.5-TESTING/lib/RT/Record.pm	Wed Oct  5 15:24:11 2005
@@ -674,7 +674,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