Last modified: 2008-07-11 18:13:46 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T10604, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 8604 - padright: and similar functions fail with non-ASCII arguments
padright: and similar functions fail with non-ASCII arguments
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: unicode
  Show dependency treegraph
Reported: 2007-01-12 13:46 UTC by Alon Lischinsky
Modified: 2008-07-11 18:13 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Alon Lischinsky 2007-01-12 13:46:43 UTC
When given a non-ASCII filler, padright: and its kin apply the right number of
an incorrect element (see [[:meta:User:Taragui#Padright test]] for an example.

Handling of Unicode seems broken in any case: non-ASCII characters in the first
argument are counted '''according to their byte length''' (i.e., as 2 to 4
characters) instead of as one each, as they should. This breaks the fix for the
unavailability of a <code>strlen</code> function proposed at
[[:meta:Talk:ParserFunctions#strlen & substr]].
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-01-12 18:49:37 UTC
This doesn't break that fix, because that probably would have done byte count too.  Note that 
Unicode characters can also be visually less than one character, e.g., combining or zero-width 
characters (although admittedly those are rarer).
Comment 2 Antoine "hashar" Musso (WMF) 2007-01-13 13:10:13 UTC
Language::pad use strlen() whereas we should use mb_strlen()
(and code a function if mbstring is not loaded)
Comment 3 Niklas Laxström 2008-07-11 18:13:46 UTC
Fixed the pad functions in r37567. Were there any others?

Note You need to log in before you can comment on or make changes to this bug.