<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>How to switch the Phorum database to support Unicode?</title>
        <description> I am running Phorum 5.1.25 and want to upgrade soon to the new stable release 5.2.7.

I wonder if I can automatically convert the existing database to support Unicode. It shows &amp;quot;latin_swedish_ci&amp;quot; right now, which has not set by me. Is there any magic button I can press to have the database converted to UTF-8 automatically?

Thanks in advance, Ulf Dunkel</description>
        <link>https://www.phorum.org/phorum5/read.php?12,129153,129153#msg-129153</link>
        <lastBuildDate>Sun, 08 Mar 2026 13:59:27 -0400</lastBuildDate>
        <generator>Phorum 5.2.22</generator>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,162092#msg-162092</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,162092#msg-162092</link>
            <description><![CDATA[ Thanks for the script!<br />
<br />
<blockquote class="bbcode"><div><small>Quote<br /></small><strong>Ulf Dunkel</strong><br />
Run the script ;-) <br />
<br />
Is it possible that this script requires Phorum 5.2.7? It won&#039;t run with 5.1.25:<br />
<br />
Fatal error: Call to undefined function: phorum_db_interact() in /.../phorum/convert_to_utf8.php<br />
<br />
Any hints?</div></blockquote>
<br />
As a simple solution, you could copy mysql.php and mysql folder from 5.2 to your installation, run the script and then restore old mysql.php. It works for me, so I can upgrade to UTF8 without having dozens of issues with upgrade to 5.2.<br />
<br />
Also you may want to comment the block for converting tables, since it&#039;s better to do manually from mysql console (also it could take a lot of time, ~5-10 min for my small phorum instance)<br />
<br />
<pre class="bbcode">
SET @DATABASE_NAME = &#039;phorum&#039;;
SELECT CONCAT(  &#039;ALTER TABLE `&#039;, t.`TABLE_SCHEMA` ,  &#039;`.`&#039;, t.`TABLE_NAME` ,  &#039;` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;&#039; ) AS sqlcode FROM  `information_schema`.`TABLES` t WHERE t . `TABLE_COLLATION` = &#039;cp1251_general_ci&#039; AND t.`TABLE_SCHEMA` =  @DATABASE_NAME ORDER BY 1 LIMIT 0 , 999;
#then execute all the queries which will be printed by this query
</pre>]]></description>
            <dc:creator>Lega4</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Mon, 06 Aug 2018 11:00:57 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,161792#msg-161792</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,161792#msg-161792</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Maurice Makaay</strong><br />
If you do get problems with serialized data, then check out the conversion script that I am working on. I already used it successfully on my own database test conversion. If you have some weird problems, then this might save you: convert_to_utf8.php.</div></blockquote>
<br />
Once I migrated the forum to UTF-8, the subject of messages is lost if it contains accentuated chars.<br />
How can I correct?]]></description>
            <dc:creator>cactux</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Mon, 30 Oct 2017 11:40:10 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129755#msg-129755</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129755#msg-129755</link>
            <description><![CDATA[ &quot;Forum description&quot; is not a serialized data field. That one should be taken care of by converting the table itself to UTF-8.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Sun, 27 Apr 2008 11:34:21 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129745#msg-129745</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129745#msg-129745</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>mmakaay</strong><br />
If you do get problems with serialized data, then check out the conversion script that I am working on. I already used it successfully on my own database test conversion. If you have some weird problems, then this might save you: <a href="http://secretsauce.phorum.org/snippets/convert_to_utf8.php.txt" target="_blank"  rel="nofollow">convert_to_utf8.php</a>.</div></blockquote>
<br />
Hi Maurice.<br />
Am I right that the &quot;Forum description&quot; field isn&#039;t converted by your script already?<br />
I tumbled over the Latvian &quot;ā&quot; when I updated my forums - see them right here: <a href="http://www.icalamus.net/phorum/index.php" target="_blank"  rel="nofollow">iCalamus Forums</a><br />
<br />
The &quot;ā&quot; in the Latvian forum is shown as &quot;?&quot; whatever I do. Unfortunately I cannot access my phpmyadmin this weekend.]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Sun, 27 Apr 2008 04:48:43 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129737#msg-129737</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129737#msg-129737</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Ulf Dunkel</strong><br />I wondered if Phorum 5.2.7 really required PHP5 but it seems to work almost fine with PHP4.</div></blockquote>
<br />
The main thing is that we don&#039;t test it with PHP 4.  So, there are no guarantees what it will do.]]></description>
            <dc:creator>Brian Moon</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Sat, 26 Apr 2008 19:28:41 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129736#msg-129736</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129736#msg-129736</link>
            <description><![CDATA[ Much ado for nothing, Thomas.<br />
You pointed me to the right place. Thanks a bunch!<br />
<br />
I wondered if Phorum 5.2.7 really required PHP5 but it seems to work almost fine with PHP4.]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Sat, 26 Apr 2008 13:33:20 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129731#msg-129731</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129731#msg-129731</link>
            <description><![CDATA[ what do you have in config.php for the charset setting?]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Sat, 26 Apr 2008 12:17:09 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129728#msg-129728</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129728#msg-129728</link>
            <description><![CDATA[ I have researched further. Check this test message:<br />
<br />
<a href="http://www.icalamus.net/phorum/read.php?9,1375" target="_blank"  rel="nofollow">Test Message for German Umlauts in UTF-8</a><br />
<br />
The umlauts are shown well in the browser:<br />
<pre class="bbcode">äöü ß àâá èêé ìîí òôó ùôú
ÄÖÜ ß ÀÂÁ ÈÊÉ ÌÎÍ ÒÔÓ ÙÛÚ</pre>
In the mySQL database, they are shown like this instead (phpMyAdmin shows UTF-8 encoding!):<br />
<pre class="bbcode">Ã¤Ã¶Ã¼ ÃŸ Ã Ã¢Ã¡ Ã¨ÃªÃ© Ã¬Ã®Ã­ Ã²Ã´Ã³ Ã¹Ã´Ãº
Ã„Ã–Ãœ ÃŸ Ã€Ã‚Ã ÃˆÃŠÃ‰ ÃŒÃŽÃ Ã’Ã”Ã“ Ã™Ã›Ãš</pre>
In a pure ANSI editor, they are shown like this:<br />
<pre class="bbcode">ÃƒÂ¤ÃƒÂ¶ÃƒÂ¼ ÃƒÅ¸ ÃƒÂ ÃƒÂ¢ÃƒÂ¡ ÃƒÂ¨ÃƒÂªÃƒÂ© ÃƒÂ¬ÃƒÂ®ÃƒÂ­ ÃƒÂ²ÃƒÂ´ÃƒÂ³ 
ÃƒÂ¹ÃƒÂ´ÃƒÂº\r\nÃƒâ€žÃƒâ€“ÃƒÅ“ ÃƒÅ¸ Ãƒâ‚¬Ãƒâ€šÃƒÂ ÃƒË†ÃƒÅ Ãƒâ€° ÃƒÅ’ÃƒÅ½ÃƒÂ Ãƒâ€™Ãƒâ€Ãƒâ€œ Ãƒâ„¢Ãƒâ€ºÃƒÅ¡</pre>
I wonder if they are really stored and read out in UTF-8 or rather in UTF-16, which would explain why they look so strange in phpMyAdmin. And it would explain why my UTF-8 encoded messages are shown wrong in Phorum.<br />
<br />
Can someone please check this?]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Sat, 26 Apr 2008 10:59:13 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129726#msg-129726</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129726#msg-129726</link>
            <description><![CDATA[ I have finally found some time to set up my Phorums from 5.1.25 to 5.2.7 and also ran the convert_to_utf8.php. I have backuped everything before and after (in different backups of course) and checked the exported .sql files for any still existing Latin-1 umlauts like &quot;äöüßÄÖÜ&quot; etc.<br />
<br />
All data in the databases are definitely UTF-8 encoded now. Browsers also show the pages (still using one of your new default templates) in UTF-8.<br />
<br />
<b>But why do I still see strange characters in browser, while they are shown the right way when I force the browser to encode in ISO-8859-1 or stuff?</b><br />
<br />
Check them out:<br />
<b><a href="http://www.calamus.net/phorum/" target="_blank"  rel="nofollow">Calamus SL Phorum</a><br />
<a href="http://www.icalamus.net/phorum/" target="_blank"  rel="nofollow">iCalamus Phorum</a></b><br />
<br />
Any hints?]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Sat, 26 Apr 2008 09:03:26 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129174#msg-129174</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129174#msg-129174</link>
            <description><![CDATA[ The field that I take care of in my script are the fields that I&#039;m aware of. These are (copied from the code):<br />
<br />
    &quot;moderator_data in {$PHORUM[&#039;user_table&#039;]}&quot;<br />
    &quot;settings_data in {$PHORUM[&#039;user_table&#039;]}&quot;<br />
    &quot;meta data in {$PHORUM[&#039;pm_messages_table&#039;]}&quot;<br />
    &quot;settings in {$PHORUM[&#039;settings_table&#039;]}&quot;<br />
    &quot;meta data in {$PHORUM[&#039;message_table&#039;]}&quot;<br />
    &quot;forum_path data in {$PHORUM[&#039;forums_table&#039;]}&quot;]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 13:20:41 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129173#msg-129173</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129173#msg-129173</link>
            <description><![CDATA[ Yes, you are right. The script is 5.2 only.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 13:17:15 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129172#msg-129172</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129172#msg-129172</link>
            <description><![CDATA[ Are the only serialized fields in the database the meta field in messages and pm_messages tables, profile_fields in settings table, and moderator_data in users table?]]></description>
            <dc:creator>DavidVB</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 12:52:57 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129171#msg-129171</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129171#msg-129171</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>mmakaay</strong><br />Run the script ;-) </div></blockquote>
<br />
Is it possible that this script requires Phorum 5.2.7? It won&#039;t run with 5.1.25:<br />
<br />
Fatal error: Call to undefined function: phorum_db_interact() in /.../phorum/convert_to_utf8.php<br />
<br />
Any hints?]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 12:36:53 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129164#msg-129164</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129164#msg-129164</link>
            <description><![CDATA[ Run the script ;-) It should leave non-problematic fields as they are and would inform you about fields that are updated because of wrong data.<br />
<br />
It&#039;s really hard to give you a case to test it out. The case would be to find serialized data that contains special characters. An example could be threads where the last author has a special character in his name. But I cannot give you a &quot;test these&quot; shortlist I&#039;m afraid.<br />
<br />
The problem is that in serialized data, PHP does write up things like &quot;the next string contains 5 characters&quot;. If those 5 characters contain special characters and you switch to UTF-8, then there is a chance that one single special character is replaced by multiple bytes in the UTF-8 version. So the string length could really become 9 characters for example in the database after converting it. The fix that needs to be done is updating the serialized data along with this to say &quot;the next string contains 9 characters&quot;. This is the exact thing that my script targets for fixing.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 09:43:30 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129162#msg-129162</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129162#msg-129162</link>
            <description><![CDATA[ I could not find any problems until now. What should I try to see if there are any problems with serialized data in my Phorum instance?]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 07:50:57 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129160#msg-129160</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129160#msg-129160</link>
            <description><![CDATA[ If you do get problems with serialized data, then check out the conversion script that I am working on. I already used it successfully on my own database test conversion. If you have some weird problems, then this might save you: <a href="http://secretsauce.phorum.org/snippets/convert_to_utf8.php.txt" target="_blank"  rel="nofollow">convert_to_utf8.php</a>.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 06:57:20 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129159#msg-129159</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129159#msg-129159</link>
            <description><![CDATA[ php arrays stored in a serialized format ( [<a href="http://www.php.net/serialize" target="_blank"  rel="nofollow">www.php.net</a>] ) which contain length of the strings stored and so on. <br />
its used in multiple places in phorum, e.g. for thread info.]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 06:55:20 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129157#msg-129157</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129157#msg-129157</link>
            <description><![CDATA[ What the heck is &#039;serialized data&#039;? :-)]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 06:48:50 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129156#msg-129156</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129156#msg-129156</link>
            <description><![CDATA[ I hope you really, really tested your phorum now as lots of serialized data can be broken this way. but maybe you are lucky and none of your serialized data contains unicode characters.]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 06:46:00 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129155#msg-129155</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129155#msg-129155</link>
            <description><![CDATA[ Hi Thomas.<br />
<br />
I did it now the manual way like this:<br />
<br />
1. Created a backup database of my P5 database.<br />
2. Converted all collations in the P5 database to utf-8.<br />
3. Exported the database as .sql dump to my hard drive.<br />
4. Deleted the P5 database and recreated it.<br />
5. Imported the .sql dump to create all tables new.<br />
6. Then I updated the @header() command in my lib.php which provokes UTF-8 encoding in http:// requests for these pages.<br />
7. Because the (Unicode) data were still shown wrong now, although the Browser set the right UTF-8 encoding, I did a fix in<br />
<br />
\include\db\mysql.php:<br />
<br />
<pre class="bbcode">
function phorum_db_mysql_connect()
{
    $PHORUM = $GLOBALS[&quot;PHORUM&quot;];
    
    static $conn;
    
    if (empty($conn))
    {
        $conn = mysql_connect($PHORUM[&quot;DBCONFIG&quot;][&quot;server&quot;], $PHORUM[&quot;DBCONFIG&quot;][&quot;user&quot;], $PHORUM[&quot;DBCONFIG&quot;][&quot;password&quot;], true);
        mysql_select_db($PHORUM[&quot;DBCONFIG&quot;][&quot;name&quot;], $conn);
        <b>mysql_query(&quot;SET NAMES utf8&quot;);</b>
    }
    
    return $conn;
}</pre>
<br />
Now everything is fine on my side (or almost everything, as the old Czech message data weren&#039;t converted properly. But this is a minor issue for me.)<br />
<br />
Enjoy: [<a href="http://www.icalamus.net/phorum/" target="_blank"  rel="nofollow">www.icalamus.net</a>]]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 06:30:46 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129154#msg-129154</guid>
            <title>Re: How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129154#msg-129154</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong></strong><br />Is there any magic button I can press to have the database converted to UTF-8 automatically?</div></blockquote>
<br />
easy answer to that: no.<br />
<br />
There are multiple steps involved, as all data itself needs to be converted and this gets more tricky with serialized arrays.]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 06:03:37 -0400</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/phorum5/read.php?12,129153,129153#msg-129153</guid>
            <title>How to switch the Phorum database to support Unicode?</title>
            <link>https://www.phorum.org/phorum5/read.php?12,129153,129153#msg-129153</link>
            <description><![CDATA[ I am running Phorum 5.1.25 and want to upgrade soon to the new stable release 5.2.7.<br />
<br />
I wonder if I can automatically convert the existing database to support Unicode. It shows &quot;latin_swedish_ci&quot; right now, which has not set by me. Is there any magic button I can press to have the database converted to UTF-8 automatically?<br />
<br />
Thanks in advance, Ulf Dunkel]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>5.1 Phorum Support</category>
            <pubDate>Fri, 28 Mar 2008 05:51:26 -0400</pubDate>
        </item>
    </channel>
</rss>
