Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/Diff/Renderer/Html/Array.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ private function getChangeExtent($fromLine, $toLine)
*/
protected function formatLines($lines)
{
foreach($lines as &$line) {
$coding = mb_detect_encoding($line, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5"), true);
if ($coding == "")
$line = "<unsupported charset>";
else if ($coding != "UTF-8")
$line = mb_convert_encoding($line, 'UTF-8', $coding);
}
$lines = array_map(array($this, 'ExpandTabs'), $lines);
$lines = array_map(array($this, 'HtmlSafe'), $lines);
foreach($lines as &$line) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Diff/Renderer/Html/SideBySide.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function render()
$changedLine = '&nbsp;';
}
else {
$toLine = $change['base']['offset'] + $no + 1;
$toLine = $change['changed']['offset'] + $no + 1;
$changedLine = '<span>'.$change['changed']['lines'][$no].'</span>';
}
$html .= '<th>'.$toLine.'</th>';
Expand Down