Recent Topics

1 Jul 29, 2006 19:20    

b2evo v1.8 could not display UTF-8 encoding properly. See the attached screenshot.

However, the problem is fixed after I commented out the following line from _main.inc.php and _blog_main.inc.php:

// Set encoding for MySQL connection:
//$DB->set_connection_charset( $evo_charset, true );

My locale config is:
* default_locale from conf: zh-TW
* default_locale from DB: zh-TW
* default_locale from HTTP_ACCEPT: en-US
* default_locale from user profile: zh-TW
* evo_charset (_main.inc.php): utf-8
* io_charset (_main.inc.php): utf-8
* Activating blog locale: zh-TW

My MySQL server version is 4.1.20.

Is this a bug or a configuration problem at my side?

2 Aug 26, 2006 15:22

It should be a common upgrade issue for utf-8 users (especially for asian locales such as chinese and japanese), but I didn't find any solution in this forum before. Let me explain the cause and the solution as follows.

I also suffered from this issue when I upgraded my b2e from 1.6 to 1.8.X.

I think this issue is caused by that 1.8 starts to use the character set support in mysql since 4.1. Without any care, the database would be created in charset latin1 by default. That is, in earlier b2e version, for a utf-8 blogger, b2e writes in utf8 encoded strings, and mysql thinks they are latin1 encoded, but since b2e just uses mysql as a "pure" storage, it works fine.

However, 1.8 tries to transcode the string according to the charset in mysql and in b2e. So your utf-8 encoded string will be latin1->utf8 again! That is QUITE annoying!

Therefore the solution without hacking in 1.8 is, to modify character set of your database to utf-8:
(This solution is for those who put utf-8 encoded strings in latin1 database.)

0. backup your database.
1. dump your database.

mysqldump --user=username --password=password --default-character-set=latin1 --skip-set-charset dbname > dump.sql


2. search and replace all latin1 to utf8
If you use vi, in command mode type

:1,$s/latin1/utf8/g


3. drop your database, and recreate it in utf-8 charset.

mysql --user=username --password=password --execute="DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;"


4. Import your dump file as utf-8 encoded.

mysql --user=username --password=password --default-character-set=utf8 dbname < dump.sql

Note: I refered to this page http://textsnippets.com/posts/show/84

Btw, if 1.8 uses the utf-8 support of mysql, does it really have backward compability of mysql 3.23 and 4.0 for utf-8 users? :roll:

-----
[url=http://www.yhtsai.idv.tw/blogs/index.php?blog=6&cat=14]PolyglotX[/url]: A b2evolution plugin for polyglots (1.6 available, 1.8 coming soon)

3 Aug 30, 2006 16:37

Hi yhtsai, thank you for the very detailed description of the issue. It is exactly as what you have described. This information will be very helpful for utf-8 users upgrading to v1.8.

4 Sep 19, 2006 01:33

I'm having some issues with special characters, such as "é, ã, ó..."

I only have acess to a web-interface of phpMyAdmin, to edit the MySQL content... Can anyone give me a hand on how to make the characters look right?

Thanks, in advance...

Almost forgot... the blog was running 100% ok, but suddenly, it became all messed up, whenever I try to post a new post, those characters do not appear.

The url is http://www.spyboy.com.br/blog/

5 Nov 09, 2006 18:09

For the guys who attempt to temporarily relieve your pain, just set the codes in file _main.inc.php and _blog_main.inc.php:

$DB->set_connection_charset( $evo_charset, true );

to

$DB->set_connection_charset( "latin1", true );

to solve the above problem mentioned by yhtsai.

Hope it is useful for you.


Form is loading...