Page MenuHomePhabricator

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

Description

( new mw.Title('ß') ).getPrefixedText() does not round-trip in some browsers. This could render the article https://en.wikipedia.org/wiki/ß 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

matmarex created this task.Oct 7 2016, 2:27 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 7 2016, 2:27 PM

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 :)

Restricted Application added a project: VisualEditor. · View Herald TranscriptOct 7 2016, 2:30 PM

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.

Esanders added a subscriber: dchan.Oct 7 2016, 8:59 PM

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

Jdforrester-WMF triaged this task as Normal priority.Oct 11 2016, 7:10 PM
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

https://gerrit.wikimedia.org/r/314725

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

https://gerrit.wikimedia.org/r/314725

matmarex closed this task as Resolved.Nov 23 2016, 6:01 PM
matmarex claimed this task.
matmarex reassigned this task from matmarex to Esanders.
matmarex removed a project: Patch-For-Review.