phplist problem with local UTF-8-characters in subject line
phplist is a popular software for sending newsletter to large lists of recievers. It has a large number of features which I will not go into depth here. For more information about what phplist can do – visit the phplist homepage.
If you are experiencing problems when you are sending a newsletter containing local characters, like the Swedish Å, Ä and Ö in the subject line, the most probable reason is that administration web pages are rendered in a character set different from the one used in the newsletter.
The following solution is assuming that you are running phplist on a Linux host.
To fix this problem, first login as admin (normally by visiting your servers URL followed by /lists/admin). Then click on the configure menu option. Scroll down until you find settings for Charset for HTML messages and Charset for Text messages. Make sure the character set suitable for your language is selected, typically UTF-8.
Preferably login to your server by SSH and go to the /lists/texts directory. Find the .inc-file for your language. In my case it is swedish.inc. Examine what encoding it has by entering:
# file --mime-encoding swedish.inc
swedish.inc: iso-8859-1
In this case, the file is in ISO-8859-1 encoding. To convert it to UTF-8 do:
# mv swedish.inc swedish.inc.iso-8859-1
# cat swedish.inc.iso-8859-1 | iconv -f iso-8859-1 -t utf-8 > swedish.inc
# file --mime-encoding swedish.inc
swedish.inc: utf-8
Now the file swedish.inc is encoded in utf-8 but we also need to open it in your favourite editor and edit the line:
$strCharSet = 'ISO-8859-1';
As you probably already guessed “ISO-8859-1” should be replaced by “UTF-8”. Save the file and exit.
Now go to your /lists/admin/lan directory and then into the directory for your country, in my case sv for Sweden. Edit the file language_info in that directory. This file contains two lines:
name=Swedish
charset=ISO-8859-1
And the guess is? Yes, of course, we have a winner – replace “ISO-8859-1” with “UTF-8”, save the file and exit. Now try to send some newsletters with local UTF-8 encoded subject lines and they will hopefully look fine in the recievers email software.