Page MenuHomePhabricator

SecurePoll's initial generation function is not unicode compliant
Closed, ResolvedPublic

Description

When showing the results of a Schulze voting, SecurePoll shows two matrices (one for 2-by-2 winning results and one for pathway strength). The row names are the usernames of the candidates, along with their initials, and the column names are just the initials.

The method that SecurePoll uses to generate the initials is not Unicode compliant therefore if the username contains multibyte characters, the initial is going to contain gibberish characters. See example here.

Event Timeline

Huji created this task.Jun 5 2016, 6:25 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 5 2016, 6:25 PM
4nn1l2 updated the task description. (Show Details)Jun 5 2016, 6:37 PM
4nn1l2 added a subscriber: 4nn1l2.
Huji added a comment.Jun 5 2016, 6:45 PM

For the record, the problem is caused by the function getOptionAbbreviations which first breaks the usernames into parts (by splitting them at spaces), and then uses $part[0] to get the first character for each part. The [0] operation does not support multibyte characters and mb_substr() should be used instead.

I will submit a patch in the next few days.

Change 304681 had a related patch set uploaded (by Huji):
First letter of the string should be fetched using ms_substr() and not using square brackets; the latter is not multibyte compliant.

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

Change 304681 merged by jenkins-bot:
First letter of the string should be fetched using ms_substr() and not using square brackets; the latter is not multibyte compliant.

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

Huji closed this task as Resolved.Aug 17 2016, 8:23 PM

My patch was merged.