Ticket #904 (fixed bug)
Charset conversion in db_update.php doesn't work
- Created: 2013-09-23 17:10:23
- Reported by: Koos
- Assigned to: Franz
- Milestone: 1.5.5
- Component: upgrading
- Priority: normal
Has no one ever tried to convert a PunBB 1.2 / FluxBB 1.2 board with a non "ISO-8859-1" charset (e.g. windows-1251) to UTF8 when upgrading to FluxBB using db_update.php? Well, it doesn't work. I've attached a patch that will fix this. Also: only the core tables are converted. What about the tables installed via mods, e.g. private messages?
History
Franz 2013-10-02 16:05:09

I don't think we can take care of converting modification tables. We've never handled them in any way during upgrades.
Visman 2013-10-03 01:03:35

For myself I did so
if ($old_charset != 'UTF-8' && !seems_utf8($str))
{
// Visman
if (function_exists('iconv') && strpos($old_charset, '1251') !== false)
$str = iconv('CP1251', 'UTF-8//IGNORE//TRANSLIT', $str);
else if (function_exists('mb_convert_encoding') && strpos($old_charset, '1251') !== false)
$str = mb_convert_encoding($str, 'UTF-8', 'CP1251');
// Visman
else if (function_exists('iconv'))
$str = iconv($old_charset == 'ISO-8859-1' ? 'WINDOWS-1252' : 'ISO-8859-1', 'UTF-8', $str);
else if (function_exists('mb_convert_encoding'))
$str = mb_convert_encoding($str, 'UTF-8', $old_charset == 'ISO-8859-1' ? 'WINDOWS-1252' : 'ISO-8859-1');
else if ($old_charset == 'ISO-8859-1')
$str = utf8_encode($str);
}
The standard code didn't convert the russian coding.
Franz 2013-11-14 00:33:41

- Status changed from open to fixed.
Fixed now, I think. Weird, I guess we were only expecting default charsets for old PunBB/FluxBB installations. Sorry about that!
Koos 2014-03-20 20:58:15

A suggestion for converting non-core tables to UTF8 when upgrading from PunBB 1.2 / FluxBB 1.2:
https://github.com/Koos10/fluxbb/commit … ce8b153188