return self::AS_TEXTBOX_EMPTY;
}
if ( $this->summary != '' ) {
- $sectionanchor = $wgParser->guessSectionNameFromWikiText( $this->summary );
+ $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->summary );
# This is a new section, so create a link to the new section
# in the revision summary.
$cleanSummary = $wgParser->stripSectionName( $this->summary );
# we can't deal with anchors, includes, html etc in the header for now,
# headline would need to be parsed to improve this
if ( $hasmatch and strlen( $matches[2] ) > 0 ) {
- $sectionanchor = $wgParser->guessSectionNameFromWikiText( $matches[2] );
+ $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $matches[2] );
}
}
wfProfileOut( __METHOD__ . '-sectionanchor' );
return '#' . Sanitizer::escapeId( $text, 'noninitial' );
}
+ /**
+ * Same as guessSectionNameFromWikiText(), but produces legacy anchors
+ * instead. For use in redirects, since IE6 interprets Redirect: headers
+ * as something other than UTF-8 (apparently?), resulting in breakage.
+ *
+ * @param $text String: The section name
+ * @return string An anchor
+ */
+ public function guessLegacySectionNameFromWikiText( $text ) {
+ # Strip out wikitext links(they break the anchor)
+ $text = $this->stripSectionName( $text );
+ $text = Sanitizer::normalizeSectionNameWhitespace( $text );
+ return '#' . Sanitizer::escapeId( $text, array( 'noninitial', 'legacy' ) );
+ }
+
/**
* Strips a text string of wikitext for use in a section anchor
*