function preprocess($str)
{
// normalize whitespace and tabs
$str = str_replace("\r\n", "\n", $str);
$str = str_replace("\r", "\n", $str);
// some browsers refuse to display empty lines
$str = preg_replace('~^$~m', " ", $str);
$str = str_replace("\t", str_repeat(' ', $this->_tabsize), $str);
return rtrim($str);
}