[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.2-35-g07e6b3f

Shawn Moore shawn at bestpractical.com
Fri Aug 25 17:31:48 EDT 2017


The branch, 4.4-trunk has been updated
       via  07e6b3f51709b6bfff68d18b4b186a74d571a18b (commit)
       via  c72888b8cb2abf7ac7941b823532422a7749c5ec (commit)
      from  d0ae708c2d68b81d0d2ac9f872075deec817913a (commit)

Summary of changes:
 lib/RT.pm | 4 ++++
 1 file changed, 4 insertions(+)

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

    Preload UTF-8 encoding module
    
    This avoids spurious errors of "Unknown encoding 'UTF-8'" when during
    development you have a syntax error in RT code. The unknown encoding
    error was especially pernicious because it completely ate the original
    syntax error message.
    
    After review, Alex pointed out that the root error was Encode::encode
    failing to load the encoding due to internal state problems in perl.
    This patch pre-loads the encoding before setting up the __WARN__
    handler.  This will avoid the Encode failing to load.  It should
    be noted that Carp.pm too needs to be preloaded or it too can fail
    at runtime inside of Encode::encode.
    
    Lastly, because Encode::encode is called without checking enabled,
    any UTF-8 strict encoding errors are discarded as warnings are disabled
    and the encoding warnings are themselves reissued with
    warnings::warnif. If the encoding warnings need to be debugged the
    check paramater Encode::LEAVE_SRC should be passed to Encode::encode.
    This will then log the original message.  This might be a useful debug
    option.
    
    Fixes: I#32648

diff --git a/lib/RT.pm b/lib/RT.pm
index e8a14c0..9141396 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -245,6 +245,10 @@ sub InitLogging {
 
     unless ( $RT::Logger ) {
 
+        # preload UTF-8 encoding so that Encode:encode doesn't fail to load
+        # as part of throwing an exception
+        Encode::encode("UTF-8","");
+
         $RT::Logger = Log::Dispatch->new;
 
         my $stack_from_level;

commit 07e6b3f51709b6bfff68d18b4b186a74d571a18b
Merge: d0ae708 c72888b
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Aug 25 17:31:43 2017 -0400

    Merge branch '4.4/utf8-internal-encoding-issue' into 4.4-trunk


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


More information about the rt-commit mailing list