diff options
author | Florian Pritz <bluewind@xinu.at> | 2012-09-10 23:37:50 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2012-09-10 23:37:50 +0200 |
commit | fcdf76c9268b971b642f132a424368cef90b58aa (patch) | |
tree | f58b37e2168c2b266a8dcb9ca46c3c71318ab1ad /application | |
parent | f4571c353faa56648f136a8c1d9ee9716d886974 (diff) |
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 <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r-- | application/controllers/file.php | 2 |
1 files changed, 1 insertions, 1 deletions
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 "<a href=\"#n$.\" id=\"n$.\">$.</a>\n"\' '.escapeshellarg($file)); echo '</pre></td><td class="code">'."\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(); |