Author: rememberthedot
Description:
Proposed patch v1
The built-in parser functions "padleft" and "padright" do not handle multibyte characters properly. For example, including {{padright:Hello-|7|Æ}} anywhere on a page blanks the entire page. Including multibyte characters in the first parameter produces unexpected results, for example:
{{padleft:Æ|5}} = 000Æ when 0000Æ was expected
{{padleft:本|5}} = 00本 when 0000本 was expected
These problems severely reduce the usefulness of the padleft and padright functions because there is no guarantee that the actual output will even remotely resemble the expected output. The output could have the wrong amount of padding, or blank the page entirely.
I'm including a patch I wrote that cleans up MediaWiki's pad function and gives it proper support for multibyte characters. It also adds a couple test cases to parserTests.txt.
Version: 1.14.x
Severity: major
Attached: