PHP config/Iconv hack

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search
Ambox outdated content.svg

This page is kept for historical interest. Its content is outdated or may be wrong.

You may find more up-to-date information on the website.

MediaWiki logo

<- MediaWiki architecture < PHP config

MediaWiki uses iconv to convert data between character sets. For most configurations, this is done mainly for conversion of URLs to and from UTF-8.

If you can't recompile PHP with iconv support and you only expect to deal with Latin-1 data, you can probably get away with defining this hackish substitute:

function iconv($from,$to,$text) {
    if(strcasecmp($from,$to) == 0) return $text;
    if(strcasecmp($from,"utf-8") == 0) return utf8_decode($text);
    if(strcasecmp($to,"utf-8") == 0) return utf8_encode($text);
    return $text;