[Mediawiki-l] FireFox URL encoding

Brion Vibber brion at wikimedia.org
Thu Mar 29 15:11:24 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Maxim wrote:
> I have my own wiki http://towiki.ru/ powered by MediaWiki, it's a
> CityWiki for Tomsk. It works fine in IE and Opera, but I have one
> problem in Firefox:
> 
> if I try to open URL (codepage in Windows is Russian: Windows-1251):
> http://towiki.ru/view/Асино
> 
> FireFox tries to retrieve incorrect URL:
> http://towiki.ru/view/%C3%80%C3%B1%C3%A8%C3%AD%C3%AE
> 
> but correct URL is:
> http://towiki.ru/view/%D0%90%D1%81%D0%B8%D0%BD%D0%BE

In order to convert incoming URLs that aren't UTF-8, MediaWiki needs to
do two things:

First, it needs to know what encoding to convert from. This is a guess
of most likely non-UTF-8 encoding based on the set up content language;
for Russian I believe we try Windows-1251.

Second, it needs to actually be able to do the conversion from that to
UTF-8. Conversions are done using iconv() if it's available as a PHP
module (not enabled by default).

But... if this module is not present, then the only conversion available
is utf8_encode() which converts only from ISO 8859-1 (Latin-1). This I
believe will produce the results you describe.

See if you can enable the iconv module for PHP; that should be able to
fix the conversion (double-check for cached redirects after making the
change).

Alternatively it may be possible to rig up a fallback conversion
function using a hardcoded table, or maybe mb_convert_encoding if that's
also available.

- -- brion vibber (brion @ wikimedia.org)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGC9ccwRnhpk1wk44RAqx2AKCAaT8yjmhfxuOI7opIPYEG2YifxQCeNs8z
NT7n66HdoWfo1dKUM+S/J1s=
=nOeG
-----END PGP SIGNATURE-----



More information about the MediaWiki-l mailing list