[Rt-commit] rt branch, 4.4/fix-shredder-wide-character-warnings, created. rt-4.4.3-196-gf061a7f52

? sunnavy sunnavy at bestpractical.com
Mon Feb 11 15:10:25 EST 2019


The branch, 4.4/fix-shredder-wide-character-warnings has been created
        at  f061a7f528f1378bf04cc374b0c9f2eeb386fc18 (commit)

- Log -----------------------------------------------------------------
commit f061a7f528f1378bf04cc374b0c9f2eeb386fc18
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Feb 12 03:17:12 2019 +0800

    Avoid "Wide character in print" warnings when generating shredder SQL output
    
    Depending on the database type, RT::Record::_AsInsertQuery could be utf8
    decoded characters(on Pg and Oralce) or utf8 encoded bytes(on MySQL and
    SQLite).  When encountering wide characters(on Pg and Oracle), perl
    issues the "Wide character" warnings as it expects bytes.
    
    This fix uses the same code as in RT::Record::__Value, for consistency.

diff --git a/lib/RT/Shredder/Plugin/SQLDump.pm b/lib/RT/Shredder/Plugin/SQLDump.pm
index 7b851f383..450cce042 100644
--- a/lib/RT/Shredder/Plugin/SQLDump.pm
+++ b/lib/RT/Shredder/Plugin/SQLDump.pm
@@ -89,6 +89,8 @@ sub Run
     my $query = $args{'Object'}->_AsInsertQuery;
     $query .= "\n" unless $query =~ /\n$/;
 
+    utf8::encode($query) if utf8::is_utf8($query);
+
     return 1 if print $fh $query;
     return (0, "Couldn't write to filehandle");
 }

-----------------------------------------------------------------------


More information about the rt-commit mailing list