Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -5081,6 +5081,21 @@ |
5082 | 5082 | } |
5083 | 5083 | |
5084 | 5084 | /** |
| 5085 | + * Same as guessSectionNameFromWikiText(), but produces legacy anchors |
| 5086 | + * instead. For use in redirects, since IE6 interprets Redirect: headers |
| 5087 | + * as something other than UTF-8 (apparently?), resulting in breakage. |
| 5088 | + * |
| 5089 | + * @param $text String: The section name |
| 5090 | + * @return string An anchor |
| 5091 | + */ |
| 5092 | + public function guessLegacySectionNameFromWikiText( $text ) { |
| 5093 | + # Strip out wikitext links(they break the anchor) |
| 5094 | + $text = $this->stripSectionName( $text ); |
| 5095 | + $text = Sanitizer::normalizeSectionNameWhitespace( $text ); |
| 5096 | + return '#' . Sanitizer::escapeId( $text, array( 'noninitial', 'legacy' ) ); |
| 5097 | + } |
| 5098 | + |
| 5099 | + /** |
5085 | 5100 | * Strips a text string of wikitext for use in a section anchor |
5086 | 5101 | * |
5087 | 5102 | * Accepts a text string and then removes all wikitext from the |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -1025,7 +1025,7 @@ |
1026 | 1026 | return self::AS_TEXTBOX_EMPTY; |
1027 | 1027 | } |
1028 | 1028 | if ( $this->summary != '' ) { |
1029 | | - $sectionanchor = $wgParser->guessSectionNameFromWikiText( $this->summary ); |
| 1029 | + $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->summary ); |
1030 | 1030 | # This is a new section, so create a link to the new section |
1031 | 1031 | # in the revision summary. |
1032 | 1032 | $cleanSummary = $wgParser->stripSectionName( $this->summary ); |
— | — | @@ -1039,7 +1039,7 @@ |
1040 | 1040 | # we can't deal with anchors, includes, html etc in the header for now, |
1041 | 1041 | # headline would need to be parsed to improve this |
1042 | 1042 | if ( $hasmatch and strlen( $matches[2] ) > 0 ) { |
1043 | | - $sectionanchor = $wgParser->guessSectionNameFromWikiText( $matches[2] ); |
| 1043 | + $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $matches[2] ); |
1044 | 1044 | } |
1045 | 1045 | } |
1046 | 1046 | wfProfileOut( __METHOD__ . '-sectionanchor' ); |