Edgewall Software

Ticket #3261: mimeview-php-unicode-stream.diff

File mimeview-php-unicode-stream.diff, 1.0 KB (added by Tim Hatch <trac@…>, 6 years ago)

Diff against trunk@3423 for a more complete fix based off r3421

  • trac/mimeview/php.py

     
    1818 
    1919from trac.core import * 
    2020from trac.config import Option 
    21 from trac.mimeview.api import IHTMLPreviewRenderer 
     21from trac.mimeview.api import IHTMLPreviewRenderer, content_to_unicode 
    2222from trac.util import NaivePopen 
    2323from trac.util.markup import Deuglifier 
    2424 
     
    6363        # -n to ignore php.ini so we're using default colors 
    6464        cmdline += ' -sn' 
    6565        self.env.log.debug("PHP command line: %s" % cmdline) 
    66  
    67         np = NaivePopen(cmdline, content.encode('utf-8'), capturestderr=1) 
     66         
     67        content = content_to_unicode(self.env, content, mimetype) 
     68        content = content.encode('utf-8') 
     69        np = NaivePopen(cmdline, content, capturestderr=1) 
    6870        if np.errorlevel or np.err: 
    6971            err = 'Running (%s) failed: %s, %s.' % (cmdline, np.errorlevel, 
    7072                                                    np.err)