Recent Topics

1 Dec 12, 2012 04:53    

Posts written in Russian look alright; but comments to them are displayed in garbage. My installation is an upgrade from 4.1.6 where everything worked fine (but only the original basic_conf file is there, I deleted all other files before installing new v5 files)

The locale for both the db and the blog is US-utf8. I suspect there's something I should change in the conf files and maybe I did it with v4 but I completely forgot what and where to change. And in any case, this version is different, so I'd appreciate any help.

Experimenting with it, I found that when I post comments anonymously, they display fine. If I then log in (as admin) and post another comment, then this logged-in comment will display in garbage, AND the previous, anonymous comments, will display in question marks. And that's how they'll stay, both in Blog view and Admin view (so I can't read the comments in Admin view) UNTIL I LOG OUT. When I log out, the question marks become letters again (and the garbage posted by admin stays as garbage). How very interesting :(

Here's an example page with a russian post (displayed well) and some russian comments (garbage by admin and ???? or normal text by anonymous).
http://moscowhikers.ru/blog1.php/olga-ivanova-24-11-12#feedbacks

Ah, and just for an experiment, let me see if this forum works - it's also b2 v5, right?
Привет мир ('Hello world' in Russian)

2 Dec 12, 2012 04:54

Ah, and just for an experiment, let me see if this forum works - it's also b2 v5, right?
Привет мир ('Hello world' in Russian)

Yeah garbage here as well. A third kind of garbage.

3 Dec 12, 2012 06:06

US-utf8 is ok, you don't need to change it. Have you selected utf8 in the installer too?
Open your profile, make sure it's set to utf8

Run this script to conveert all database tables to utf-8.
Save the code as a file, upload it to b2evolution directory and open with your browser

require dirname(__FILE__).'/conf/_config.php';
require $inc_path.'_main.inc.php';

$DB->halt_on_error = true;

foreach( $DB->get_col('SHOW TABLES FROM '.$db_config['name'].' LIKE "'.$tableprefix.'%"') as $table )
{
	echo "Converting $table... ";
	$DB->query('ALTER TABLE '.$table.'
				DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci,
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci');
}

echo "Changing default charset of DB...";
$DB->query('ALTER DATABASE '.$db_config['name'].' CHARACTER SET utf8 COLLATE utf8_general_ci');

4 Dec 12, 2012 06:07

This forum is not converted to utf8 yet.

5 Dec 12, 2012 07:38

Have you selected utf8 in the installer too?

Yes, US-utf8

Open your profile, make sure it's set to utf8

sorry for this question but Where is my profile? If it's Admin mode - System - Locales, Regional Settings option - then yes, it's "English (US) utf8"

Run this script to conveert all database tables to utf-8.
Save the code as a file, upload it to b2evolution directory and open with your browser

Well it didn't help. Or maybe it was useful but not enough. In any case, after running the script (it said 'converting..... about a lot of tables) the problem remained.

However, I googled around and found the same info page that I used as reference when setting up v4:

How I got b2evolution to work in both English and Russian with UTF-8
http://shininghappypeople.net/deljr/b2e-russian-english.html

And did what the page recommends (and I think the same as I did in v4 when setting it up): in _locales.php,
I modified these lines, setting them to utf-8:

$evo_charset = 'utf-8';
$force_io_charset_if_accepted = 'utf-8';
$db_config['connection_charset'] = 'utf8';

I confess I don't really understand what they do but now the comments display just fine. No garbage and no question marks. Hopefully I won't have "issues" the locales file warns about!...

DO NOT CHANGE THIS if your language requires UTF8 (East Asian, Arabic, etc, etc, etc) !!!
* This is NOT the correct way to do it. If you change this setting it may look like it works but YOU WILL HAVE ISSUES!

6 Dec 12, 2012 16:07

I believe if you leave only $db_config['connection_charset'] = 'utf8'; it should be enough.

$force_io_charset_if_accepted = 'utf-8'; is not used in v5

Try this

$db_config['connection_charset'] = 'utf8';

If the above won't work, add the second line

$evo_charset = 'utf-8';
$db_config['connection_charset'] = 'utf8';

Anyway, it's safe to use those settings.


Form is loading...