[Rt-commit] rt branch, 4.4/utf8-internal-encoding-issue, created. rt-4.4.1-327-gdfb1be1

Dave Goehrig dave at bestpractical.com
Tue Mar 28 14:51:41 EDT 2017


The branch, 4.4/utf8-internal-encoding-issue has been created
        at  dfb1be1368802f8ceb274803b55cb58dfe85998e (commit)

- Log -----------------------------------------------------------------
commit dfb1be1368802f8ceb274803b55cb58dfe85998e
Author: Dave Goehrig <dave at bestpractical.com>
Date:   Tue Mar 28 14:47:28 2017 -0400

    UTF-8 is not utf8 and not UTF8
    
    The issue here is perl internally uses utf8 as it's
    UTF8 encoding format (it is a looser definition of
    UTF8-ness).  By trying to coerce to the strict
    UTF-8 flag, the encoding of the interal perl
    presentation of the code break resulting in the
    encoding error throwing while trying to encode the
    original error message, hiding the actual syntax error.
    
    The solution is to switch it to use UTF8 (synonym for utf8)
    by removing 2 characters.  This way it properly encodes
    the error message using perl's internal utf8 format.
    
    cf http://perldoc.perl.org/Encode.html#UTF-8-vs.-utf8-vs.-UTF8
    
    Fixes: I#32648

diff --git a/lib/RT.pm b/lib/RT.pm
index e8a14c0..b6e754f 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -267,7 +267,7 @@ sub InitLogging {
             my ($package, $filename, $line) = caller($frame);
 
             # Encode to bytes, so we don't send wide characters
-            $p{message} = Encode::encode("UTF-8", $p{message});
+            $p{message} = Encode::encode("UTF8", $p{message});
 
             $p{'message'} =~ s/(?:\r*\n)+$//;
             return "[$$] [". gmtime(time) ."] [". $p{'level'} ."]: "
@@ -285,7 +285,7 @@ sub InitLogging {
             my ($package, $filename, $line) = caller($frame);
 
             # Encode to bytes, so we don't send wide characters
-            $p{message} = Encode::encode("UTF-8", $p{message});
+            $p{message} = Encode::encode("UTF8", $p{message});
 
             $p{message} =~ s/(?:\r*\n)+$//;
             if ($p{level} eq 'debug') {

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


More information about the rt-commit mailing list