Sorted wikitables of type currency do not recognize minus signs. In wikibits.js, ts_currencyToSortKey could be changed from
return ts_parseFloat(s.replace(/[^0-9.,]/g,''));
to
return ts_parseFloat(s.replace(/[^-0-9.,]/g,''));
and this would half-fix the problem. But it does not fully fix the problem, because this recognizes the hyphen, -, but not the HTML minus sign, −. Columns of type numeric do not recognize minus signs, either. An example of the latter bug can be viewed at:
http://en.wikipedia.org/w/index.php?title=Wikipedia:Arbitration_Committee_Elections_December_2009&diff=prev&oldid=332579916 (Broken sort using minus signs)
ttp://en.wikipedia.org/w/index.php?title=Wikipedia:Arbitration_Committee_Elections_December_2009&diff=next&oldid=332579916 (Working sort using hyphens)
Sorting on minus signs in columns of type numeric could be fixed by going to ts_parseFloat and changing
num = parseFloat(s.replace(/,/g, ""));
to
num = parseFloat(s.replace(/,/g, "")).replace(/−/gi, "-").replace(/&(?:minus|#x0*2212|#0*8722);/gi, "-")
which would convert HTML minus signs to hyphens before attempting to parse the number; but this would not handle minus signs in currency values, because they would be removed by ts_currencyToSortKey before ts_parseFloat is called.
A more comprehensive solution to this is to substitute characters for entity references in ts_resortTable before the preprocessor is called (or maybe even before the preprocessor is chosen). To fix the bugs with minus signs it would suffice to convert minus sign references as above, but it may be desirable to convert all entity references.
Version: unspecified
Severity: minor