[Rt-commit] r3849 - in rt/branches/3.4-RELEASE: . lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Tue Sep 13 12:07:56 EDT 2005


Author: jesse
Date: Tue Sep 13 12:07:54 2005
New Revision: 3849

Modified:
   rt/branches/3.4-RELEASE/   (props changed)
   rt/branches/3.4-RELEASE/lib/RT/Record.pm
Log:
 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.4-RELEASE/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Record.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Record.pm	Tue Sep 13 12:07:54 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