Skip to content

JSPWIKI-492 Allow the superscript digits in page names - #573

Open
arturobernalg wants to merge 3 commits into
apache:masterfrom
arturobernalg:bug/JSPWIKI-492
Open

arturobernalg wants to merge 3 commits into
apache:masterfrom
arturobernalg:bug/JSPWIKI-492

Conversation

@arturobernalg

@arturobernalg arturobernalg commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

https://issues.apache.org/jira/browse/JSPWIKI-492

TextUtil.cleanString keeps letters, digits and the characters of PUNCTUATION_CHARS_ALLOWED. The superscript digits are neither letters nor digits for Character.isLetterOrDigit, so MarkupParser.cleanLink removed them: Metre² became Metre when a page was referred to by a link, although a page saved under that name exists.

PUNCTUATION_CHARS_ALLOWED now also holds ¹, ² and ³ (as unicode escapes). LEGACY_CHARS_ALLOWED, used by wikifyLink, is not changed. The report is about ² and ³; I did not look at other characters.

LuceneSearchProvider also reads PUNCTUATION_CHARS_ALLOWED: it replaces those characters by spaces in the raw page name that it indexes. A page saved as Metre² is found by Metre, name:Metre* and Metre², on master and with this change; SearchManagerTest.testTitleSearchWithSuperscriptDigit covers it.

Tests: TextUtilTest.testCleanStringKeepsSuperscriptDigits and MarkupParserTest.testCleanLinkKeepsSuperscriptDigits fail on master (expected: <Metre²> but was: <Metre>) and pass with the change. TextUtilTest, MarkupParserTest, SearchManagerTest and JSPWikiMarkupParserTest pass on the branch. I did not run the whole test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant