[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.9-45-g08ae310

Kevin Falcone falcone at bestpractical.com
Fri Apr 1 09:56:09 EDT 2011


The branch, 3.8-trunk has been updated
       via  08ae31080d1ddf95b30a73e6ec8af909a68f4030 (commit)
      from  df84d7e92eafd4317be76ae30c3a6d699a1b4502 (commit)

Summary of changes:
 lib/RT/Interface/Web.pm |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 08ae31080d1ddf95b30a73e6ec8af909a68f4030
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Mar 31 18:18:26 2011 -0400

    CGI.pm 3.51 started tossing charset onto every content-type
    
    This means you get charset on images.  A bug has been filed:
    https://rt.cpan.org/Ticket/Display.html?id=67100
    and hopefully 3.53 will fix this.  I can't figure out how to make
    charset '' from Mason, so I can't rescue images, but I can at least make
    our JS be served as utf-8.  At least two parts of fckeditor include BOM
    that are interpreted as a parse error when CGI flags them as
    charset=ISO-8859-1

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 8250da3..90a699f 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -796,6 +796,13 @@ sub SendStaticFile {
         }
         $type ||= "application/octet-stream";
     }
+
+    # CGI.pm version 3.51 and 3.52 bang charset=iso-8859-1 onto our JS
+    # since we don't specify a charset
+    if ( $type =~ m{application/javascript} &&
+         $type !~ m{charset=([\w-]+)$} ) {
+         $type .= "; charset=utf-8";
+    }
     $HTML::Mason::Commands::r->content_type($type);
     open( my $fh, '<', $file ) or die "couldn't open file: $!";
     binmode($fh);

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


More information about the Rt-commit mailing list