Very olf Phorum upgrade charset problems
Posted by Ignas
Very olf Phorum upgrade charset problems March 15, 2017 03:41AM |
Registered: 7 years ago Posts: 6 |
Re: Very olf Phorum upgrade charset problems March 15, 2017 03:50AM |
Registered: 7 years ago Posts: 6 |
Also I've tried to connect to the same database (on the old machine) with PDO based script on the same machine and a new one (Apache 2.4.10, PHP 5.6.30) and I get different results - script on the one old machine (PHP 5.26) echoes all symbols correctly, while on the new one (PHP 5.6.30) I get unreadable charecters.
The script is very simple:
<?php
$host = '192.168.0.209';
$db = 'phorum';
$user = 'forumas';
$pass = '*****';
$charset = 'utf8';
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$opt = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false
];
$pdo = new PDO($dsn, $user, $pass, $opt);
$stmt = $pdo->query('SELECT * FROM phorum_forums');
while ($row = $stmt->fetch())
{
echo $row['forum_id'] . ' // ' . $row['description'] . "\n";
}
?>
The script is very simple:
<?php
$host = '192.168.0.209';
$db = 'phorum';
$user = 'forumas';
$pass = '*****';
$charset = 'utf8';
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$opt = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false
];
$pdo = new PDO($dsn, $user, $pass, $opt);
$stmt = $pdo->query('SELECT * FROM phorum_forums');
while ($row = $stmt->fetch())
{
echo $row['forum_id'] . ' // ' . $row['description'] . "\n";
}
?>
Re: Very olf Phorum upgrade charset problems March 15, 2017 03:52AM |
Registered: 7 years ago Posts: 6 |
Re: Very olf Phorum upgrade charset problems March 15, 2017 04:30AM |
Registered: 7 years ago Posts: 6 |
Re: Very olf Phorum upgrade charset problems March 15, 2017 06:03AM |
Admin Registered: 18 years ago Posts: 744 |
Hi Ignas,
please check which (default) collation you are using in mysql. My Phorum tables are using utf8_unicode_ci.
Regards
Oliver
Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
please check which (default) collation you are using in mysql. My Phorum tables are using utf8_unicode_ci.
Regards
Oliver
Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Very olf Phorum upgrade charset problems March 15, 2017 06:23AM |
Registered: 7 years ago Posts: 6 |
Re: Very olf Phorum upgrade charset problems March 15, 2017 09:07AM |
Admin Registered: 18 years ago Posts: 744 |
Hi Ignas,
do you use phpmyadmin?
Or
where test is the table name. See: [dev.mysql.com]
Regards
Oliver
Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
do you use phpmyadmin?
Or
show table status like 'test';
where test is the table name. See: [dev.mysql.com]
Regards
Oliver
Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Very olf Phorum upgrade charset problems March 15, 2017 09:52AM |
Registered: 7 years ago Posts: 6 |
show table status like 'phorum_forums';
+---------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+---------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
| phorum_forums | MyISAM | 10 | Dynamic | 7 | 197 | 1380 | 281474976710655 | 5120 | 0 | 18 | 2007-06-27 16:02:08 | 2017-03-12 13:38:10 | 2017-03-12 21:57:37 | latin1_swedish_ci | NULL | | |
+---------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
+---------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+---------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
| phorum_forums | MyISAM | 10 | Dynamic | 7 | 197 | 1380 | 281474976710655 | 5120 | 0 | 18 | 2007-06-27 16:02:08 | 2017-03-12 13:38:10 | 2017-03-12 21:57:37 | latin1_swedish_ci | NULL | | |
+---------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
Re: Very olf Phorum upgrade charset problems March 17, 2017 04:45AM |
Admin Registered: 18 years ago Posts: 744 |
Hi Ignas,
to set the default character set for the database (replace "phorum" with your database name if it varies) before creating/importing:
ALTER DATABASE phorum CHARACTER SET utf8 COLLATE utf8_general_ci;
You have to check also the collation in your import script file.
Regards
Oliver
Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
to set the default character set for the database (replace "phorum" with your database name if it varies) before creating/importing:
ALTER DATABASE phorum CHARACTER SET utf8 COLLATE utf8_general_ci;
You have to check also the collation in your import script file.
Regards
Oliver
Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Sorry, only registered users may post in this forum.