Home Documentation General Docs Joom!Fish, encodings and UTF-8
Joom!Fish, encodings and UTF-8 PDF Print E-mail
Written by Ivo Apostolov   
Monday, 28 May 2007 01:41

This article relates to Joomfish 1.8 and Joomla 1.0 and is not relevant to Joomfish 2.0 on Joomla 1.5.

Due to the many questions in the last weeks, I will try to summarize some issues with encoding on multilanguage sites with 1.0 series.
Basically, bilanguage sites, where one of the languages is English do not have problems with encoding, but if you experience such, I would highly advise you to put the Non-English language as default. This will allow you to run your Joomla! Backend on that language and in most of the cases, this solves 99% of the encoding problems and database missmatches in collations. If you still experience problems with the encoding of the other language, this is caused almost in all of the cases by the apache (or other server) default encoding, that is preset. On some servers, this encoding is sent as a header in the cookie and causes issues. In such case, there is easy and fast solution:

- Open the file globals.php and at the end of it, right after the last

Code:
}
and right before
Code:
?>
put the following code:
Code:
header("Content-Type: text/html; charset=ENCODING");
where ENCODING should be replaced by the encoding used for the language that is not English. Example (Windows Cyrillic):
Code:
header("Content-Type: text/html; charset=windows-1251");

While with bilingual sites it is more or less easy and problemless, when it happens that you need to build a web site in three languages or even in two languages, where these use different charsets and none of them is English, I would highly recommend you to consider a fully UTF-8 web site.

How to do it?
Please do these actions, before installing Joomla!
1. Create your database manually and go to operations, there set a collation of the database as utf8_general_ci.
2. Open the file includes/database.php go to line 102 and change the following code from:
Code:
//        @mysql_query("SET NAMES 'utf8'", $this->_resource);
to:
Code:
        @mysql_query("SET NAMES 'utf8'", $this->_resource);

Screenshots:

{gallery}screenshots{/gallery}

Now save the file.
3. Open the file globals.php and at the end of it, right after the last

Code:
}
and right before
Code:
?>
put the following code:
Code:
header("Content-Type: text/html; charset=UTF-8");

4. Open the file language/english.php and go on line 421. Change the following code from:

Code:
DEFINE('_ISO','charset=iso-8859-1');
to:
Code:
DEFINE('_ISO','charset=UTF-8');

5. Upload Joomla! and install Joomla! in the normal way.
6. When you install new languages, please be sure that those are saved as UTF-8 without BOM. Very cool editors that allow this are Crimson Editor and Notepad++

That's it. Now everything is expected to work like a charm. More information about how Joomla! 1.0.x handles UTF-8 is available in the following post:
http://forum.joomla.org/index.php/topic,55065.0.html
You can also consider to use the hack that allows generation of PDF documents in UTF and works for probably any language:
http://forum.joomla.org/index.php/topic,110713.0.html

Author note:
Older versions of MySQL doesn't supports databases with collation utf8_general_ci, then you most probably would not be able to create a fully compatible UTF-8 site.

 

0 Comments

Add Comment

Joom!Fish 2.0 RC download

Selected Contributors

From the Joom!Fish Core team (Alex, Geraint, Ivo & Robin) a big thank you to all the people of the JoomFish community!
Special thank's for testing, good suggestions, translations and forum moderation to:

  • Tommy White for the cute logo design
  • Bernhard, Michael, Luc, Olivier, Robin, Rune, Akarawuth
  • Harri <aka tassu> for moderation

Recommended Reading

Buy Joomla! 1.5 with directshopper