From fcdf76c9268b971b642f132a424368cef90b58aa Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 10 Sep 2012 23:37:50 +0200 Subject: Let pygments guess input encoding Assuming utf8 breaks if the input file is latin1. This automaticaly guesses if it's utf8 or latin1. If this isn't enough, we can switch to chardet, but that adds a new dependency. Signed-off-by: Florian Pritz --- application/controllers/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application/controllers') diff --git a/application/controllers/file.php b/application/controllers/file.php index f900419cb..7c5918e07 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -179,7 +179,7 @@ class File extends CI_Controller { // generate line numbers (links) passthru('perl -ne \'print "$.\n"\' '.escapeshellarg($file)); echo ''."\n"; - passthru('pygmentize -F codetagify -O encoding=utf-8 -l '.escapeshellarg($mode).' -f html '.escapeshellarg($file)); + passthru('pygmentize -F codetagify -O encoding=guess,outencoding=utf8 -l '.escapeshellarg($mode).' -f html '.escapeshellarg($file)); } $cached = ob_get_contents(); ob_end_clean(); -- cgit v1.2.3-24-g4f1b