Colon function for encoding url's in iso-8859-1
Open, LowPublic


Author: baard

Some sites require that urls are encoded in iso-8859-1. To support generating
valid url's from templates, a new function is required.
The code to generate this would look like:

return urlencode( utf8_decode ( $s ));

Version: unspecified
Severity: enhancement


bzimport set Reference to bz7389.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Sep 23 2006, 8:37 AM

baard wrote:

URL's to the external website '''' and other requires that parameters are
encoded in iso-8859-1, not UTF-8.
A link to a map showing the city ''Ålesund'' might be,+%C5LESUND,+By.
Note the Å is encoded as %C5, not %C3%85 as urlencode will return.

A new colon function, for example urlencode_iso8859-1, that encodes the
parameters as iso-8859-1 will solve this problem.

See also

baard wrote:

Patch to enable urlencodeiso

Attached: urlencodeiso.patch

ayg wrote:

There's no way MediaWiki can ever account for every oddball URL encoding method
without implementing full-fledged string functions: just the other day I
encountered a site that somehow double-urlencoded its URLs, so there was a "25"
just before every byte's hex representation. Heck, MediaWiki itself uses an
unusual encoding, converting spaces to _ instead of +. What about ISO 8859-2
through -15, for instance?

nsaa wrote:

ISO 8859-1 is "is the basis of two widely-used character maps known as
ISO-8859-1 (note the extra hyphen) and Windows-1252.

In June 2004, the ISO/IEC working group responsible for maintaining eight-bit
coded character sets disbanded and ceased all maintenance of ISO 8859, including
ISO 8859-1, in order to concentrate on the Universal Character Set and Unicode.
In computing applications, encodings that provide full UCS support (such as
UTF-8 and UTF-16) are finding increasing favor over encodings based on ISO
8859-1." from [[:en:/ISO/IEC_8859-1]]. So ISO-8859-1 is highly more relevant
than other kinds of encodings? ~~~~

baard wrote:

So a patch is rejected if it only solves one problem and leaves other problems

ayg wrote:

Nobody has rejected your patch; otherwise this would be marked WONTFIX. I'm not
even a developer. I'm just giving my opinion: we probably don't want 352 colon
functions. That sounds suspiciously like feature creep. If any developer
disagrees, which some may well, they'll commit the patch. There's no point
discussing it here further either way.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

sumanah wrote:

+need-review to signal to developers that this patch needs reviewing

audreyt wrote:

Hi Bård, thank you for the patch!

As you may already know, MediaWiki is currently revamping its PHP-based parser
into a "Parsoid" prototype component, to support the rich-text Visual Editor

Folks interested in enhancing the parser's capabilities are very much welcome
to join the Parsoid project, and contribute patches as Git branches:

Compared to .diff attachments in Bugzilla tickets, Git branches are much easier
for us to review, refine and merge features together.

Each change set has a distinct URL generated by the "git review" tool, which
can be referenced in Bugzilla by pasting its URL as a

If you run into any issues with the patch process, please feel free to ask on #wikimedia-dev and the wikitext-l mailing list. Thank you!

Add Comment