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

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

My patch was merged.