From e480233eb8189acd0b18309a9f78a340b6c84077 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 24 Jun 2011 10:16:07 -0700 Subject: [PATCH] Remove UTF-8 kludges from Differential Summary: This depends on D513 and D514. Those diffs make the display algorithms safe with respect to mutating utf8, so we no longer need to repair potentially invalid utf8 sequences with this hack. Test Plan: grepped for calls to this method Reviewers: jungejason, aran, tuomaspelkonen Commenters: jungejason CC: aran, epriestley, jungejason Differential Revision: 515 --- .../changeset/DifferentialChangesetParser.php | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php index b2e6b12973..fb6c5befa1 100644 --- a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php @@ -520,9 +520,6 @@ class DifferentialChangesetParser { ipull($this->intra, 1), $new_corpus); - $this->tokenHighlight($this->oldRender); - $this->tokenHighlight($this->newRender); - $generated = (strpos($new_corpus_block, '@'.'generated') !== false); $this->specialAttributes[self::ATTR_GENERATED] = $generated; @@ -710,23 +707,6 @@ class DifferentialChangesetParser { return implode('', $result); } - - protected function tokenHighlight(&$render) { - // TODO: This is really terribly horrible and should be fixed. We have two - // byte-oriented algorithms (wordwrap and intraline diff) which are not - // unicode-aware and can accept a valid UTF-8 string but emit an invalid - // one by adding markup inside the byte sequences of characters. The right - // fix here is to make them UTF-8 aware. Short of that, we can repair the - // possibly-broken UTF-8 string into a valid UTF-8 string by replacing all - // UTF-8 bytes with a Unicode Replacement Character. - foreach ($render as $key => $text) { - $render[$key] = preg_replace( - '/[\x80-\xFF]/', - ''."\xEF\xBF\xBD".'', - $text); - } - } - protected function getHighlightFuture($corpus) { return $this->highlightEngine->getHighlightFuture( $this->filetype,