How to configure UTF-8 in phpList

General talk about translations & I18n (Internationalization)

How to configure UTF-8 in phpList

Postby H2B2 » 8:44pm, Tue 23 Nov, 2010

In order to work correctly, all relevant charset settings must point in the same direction. These are the charset settings that work on my system (tested with 2.10.12 and 2.10.13):

    1. Charset for messages
    On the 'configuration page', check these settings:
    - Charset for HTML messages: UTF-8
    - Charset for Text messages: UTF-8

    2. Charset of public pages
    The charset of public pages can be set in the language file you configured in config.php (e.g. $language_module = "your_language.inc"; )
    - Check this in your_language.inc: $strCharSet = 'UTF-8';
    - Check that you selected the same language file in the "Language file to use" dropdown list when editing your subscribe page.
    Note: make sure that lists/texts/your_language.inc is actually encoded in UTF-8.

    3. Charset of admin interface pages
    Since v2.10.11, the charset of admin interface pages should be set to UTF-8 in the language_info file that corresponds to the admin language you selected. In the case of English, you will need to add a language_info file to lists/admin/lan/en/ with the following contents:
    Code: Select all
    name=English
    charset=UTF-8
    Note: If you are using another admin language than English, the corresponding language_info file probably already exists. Just check its contents to make sure it is set to UTF-8. For instance, if you select Spanish as the language to use in the administrator interface, check lists/admin/lan/es/language_info

    4. Database encoding (in phpMyAdmin: SHOW VARIABLES LIKE 'character_set_%' )
    character_set_client: utf8
    character_set_connection: utf8
    character_set_database: utf8
    character_set_results: utf8
    character_set_server: latin1
    character_set_system: utf8

    If you need to change the charset encoding of your database you can enter the following command in phpMyAdmin:
    ALTER DATABASE <db_name> DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
    Afterwards, check with: SHOW VARIABLES LIKE 'c%'

    Note: Be careful with changing the database encoding of a production install. Make sure you backup your database before attempting to change its encoding and converting the data it contains. I recommend testing the conversion on a sandbox installation, not directly on your production install.
    For some in-depth info on MySQL encoding see: http://mysql.rjweb.org/doc.php/charcoll

When testing your modified setup, best create a new message, as the old message will contain characters that have been saved to the database with an incorrect encoding.


See also: How to configure phpList with non-UTF-8 charsets
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: How to configure UTF-8 in phpList

Postby TomasM » 4:51am, Sat 07 May, 2011

I would like to add an important detail. It is not enough to change the collation of the tables to UTF-8. Most likely you will also have to change individual fields' collation like:

Table: phplist_message
Fields: subject, message, textmessage

Table: phplist_list
Fields: name, description

You may need to change additional fields in case you need UTF-8 encoding there. I spent many hours, until I realized this, I hope that will help you guys ;)
TomasM
phpList newbie
 
Posts: 1
Joined: 4:15am, Sat 07 May, 2011

Re: How to configure UTF-8 in phpList

Postby IronDog » 4:24pm, Mon 03 Oct, 2011

Hello,

I am trying to set up a PHPList in Russian (Cyrillic), UTF-8. I've noticed that russian.inc that ships with PHPList has $strCharSet='windows-1251' and I have read that UTF-8 is hard-coded in the PHP code.
I've transformed russian.inc from windows-1251 into UTF-8, and specified russian.inc in the config.php. The front page is still gibberish and only becomes Russian if one specifies the desired encoding explicitly to the browser. In other words, the HTML itself does not appear to be self-documented. In the HTML for the front page, I see

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

I believe iso-8859-1 is inconsistent with the goal of getting Russian via UTF-8.
How do I correct that META?

Thanks!
IronDog
phpList newbie
 
Posts: 2
Joined: 4:13pm, Mon 03 Oct, 2011

Re: How to configure UTF-8 in phpList

Postby Ryneh » 1:44am, Mon 05 Mar, 2012

Hi IronDog:

I encountered the same situation like yours. Hope my experience helps. :D
viewtopic.php?p=90956
Ryneh
phpList newbie
 
Posts: 3
Joined: 2:50am, Thu 01 Mar, 2012

Re: How to configure UTF-8 in phpList

Postby acastles » 10:16pm, Thu 25 Oct, 2012

To correct the problem in the meta tag, I found that I had to modify the file in
/lists/admin/languages.php
and change the $LANGUAGES array so that the (in my case) English line says:
Code: Select all
"en" => array("English","utf-8","utf-8"),


Hope that helps,

Andy
acastles
phpList newbie
 
Posts: 1
Joined: 10:12pm, Thu 25 Oct, 2012

Re: How to configure UTF-8 in phpList

Postby protonotarios » 7:27pm, Sat 16 Feb, 2013

It should be noted that the database charset encoding change
H2B2 wrote:ALTER DATABASE <db_name> DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci

must be done right after the creation of the database and before the creation of the tables by setup. Because this command does not convert existing tables, it only sets the default for new ones.
(It took me 2 days to realise this)
protonotarios
phpList newbie
 
Posts: 1
Joined: 7:11pm, Sat 16 Feb, 2013

Re: How to configure UTF-8 in phpList

Postby sampei » 9:58am, Thu 20 Jun, 2013

that's the reason why it says "default". However if you didn't do it you can still update each tables manually - perhaps takes 5 minutes longer but the result is the same...


________________
A programmer looks both ways before crossing a one-way street
sampei
phpList newbie
 
Posts: 1
Joined: 7:47am, Sun 02 Jun, 2013

Re: How to configure UTF-8 in phpList

Postby KhanhHQ123 » 8:38am, Tue 17 Dec, 2013

The way of Andy works perfectly.

After searching for minutes, i found an official FAQ of PhPList for all you guys to know more about this problem: http://docs.phplist.com/PhplistFAQ.html
KhanhHQ123
phpList newbie
 
Posts: 1
Joined: 8:27am, Tue 17 Dec, 2013


Return to Translators & Internationalization

Who is online

Users browsing this forum: No registered users and 2 guests