Page MenuHomePhabricator

Support for non-ASCII characters in {{padleft:}} and {{padright:}} Magic Words
Closed, ResolvedPublic

Description

{{padleft:}} and {{padright:}} doesn't support non-ASCII characters.

{{padleft:<word>|<repeats>|<character>}}

  • Non-ASCII characters in the <word> field makes the <word> character count to grow, like each non-ASCII character counts as two or more ASCII characters.

Examples:

"{{padleft:cafe|8|-}}" gives "----cafe"

"{{padleft:café|8|-}}" gives "---café"

"{{padleft:caf♥|8|-}}" gives "--caf♥"

maybe because "e" is represented by 1 byte, "é" is represented by 2 bytes and "♥" is represented by 3 bytes.

  • Non-ASCII characters in the <character> field makes the character that fills the extra gaps to be a "?", maybe because it only takes the first byte of the character represenation while the character is 2 or more bytes length.

Look http://meta.wikimedia.org/wiki/Help:Magic_words#Formatting


Version: unspecified
Severity: normal

Details

Reference
bz12324

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:55 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz12324.
bzimport added a subscriber: Unknown Object (MLST).

Something really strange. Look at this page: http://meta.wikimedia.org/w/index.php?title=Help%3AMagic_words&diff=794659&oldid=794618.

When I edited that page, it was showing the content as normally, but some users complained about that the page was empty.

I don't know if that's related to that magic word, because when previewing the content is shown, but when saved no. Ant it happens randomly.

Please, go to http://meta.wikimedia.org/w/index.php?title=User:Ciencia_Al_Poder/test&oldid=803241 (the first revision of the page) and hit the "Newer revision→" link until reach the last revision (at this moment, there are only 4 revisions) and annotate (in a paper, a note, a text file...) if the content is shown or not in each revision. Then return to the first revision (via history page, history of the browser, a link, etc) and do the same process (hit the "Newer revision→" link until reach the last revision) two or three times, annotating the result of each one. At least for me, none of them match!, That's what I got:

  • oldid=803241: no content
  • Newer revision: content
  • Newer revision: content
  • Newer revision: content

(going to history and select the first revision)

  • oldid=803241: content
  • Newer revision: content
  • Newer revision: no content
  • Newer revision: no content

(going to history and select the first revision)

  • oldid=803241: content
  • Newer revision: content
  • Newer revision: no content
  • Newer revision: no content

(going to history and select the first revision)

  • oldid=803241: no content
  • Newer revision: content
  • Newer revision: no content
  • Newer revision: content

(the 2nd and 3rd are equal but may be a coincidence)

Duping to 16852, since it already has a proposed patch.

  • This bug has been marked as a duplicate of bug 16852 ***