Page MenuHomePhabricator

`( new mw.Title('ß') ).getPrefixedText()` does not round-trip in Chromium
Closed, ResolvedPublic1 Estimated Story Points


( new mw.Title('ß') ).getPrefixedText() does not round-trip in some browsers. This could render the articleß inaccessible by some JavaScript tools. (See also T141723.)

The correct result is 'ß', incorrect results are 'SS' or 'ẞ'. Chromium 54 gives me 'SS', Firefox and Edge are OK.

Event Timeline

In particular, it seems to be impossible to link to the article using VisualEditor's link inspector. I am therefore making this the VE team's problem :)

The problem is that we use toUpperCase to normalise titles. 'ß'.toUpperCase is 'SS' in Chrome.

From the other task:

MediaWiki uses PHP's mb_strtoupper function for capitalizing, which does not change 'ß' when uppercasing. (Looking at the source code, it only seems to be capable of case changes which do not change the length of the string, so no 'ß' → 'SS'.) If your method of uppercasing is smarter than that, it won't work correctly…

Perhaps comparing the length of str and str.toUpperCase() (where str is first letter of page title), and only using str.toUpperCase() if the lengths are the same, would be correct? I'd guess that 'ß' is not the only case (eheh) where this happens.

Comparing the length only works if the length changes. The article on 'ß' says it is unique in not having a capitalisation, we should really write a script to compare the output of mb_strtoupper and toUpperCase and come up with a mapping for any other cases that fail, but this may the only sensible case that fails.

It is not the only case, see the discussion on T141723.

We don't really need two tickets for this bug.

Jdforrester-WMF moved this task from To Triage to TR0: Interrupt on the VisualEditor board.
Jdforrester-WMF set the point value for this task to 1.

Change 314725 had a related patch set uploaded (by Esanders):
Add exception in mw.Title for 'ß'.toUpperCase() so it matches PHP

Change 314725 merged by jenkins-bot:
Add exceptions in mw.Title where mb_strtoupper doesn't match String.toUpperCase

matmarex claimed this task.
matmarex reassigned this task from matmarex to Esanders.
matmarex removed a project: Patch-For-Review.