UTF-8 issues (and how to fix them)

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
StudioTandem
Posts: 9
Joined: Thu 4. Nov 2004, 20:14
Location: Maribor, Slovenia
Contact:

UTF-8 issues (and how to fix them)

Post by StudioTandem »

I have the same problem as it is described in this thread http://www.phpwcms.de/forum/viewtopic.php?t=8979

Some characters didn't show up OK in utf-8 encoded page (not in the backend, not in the front end), specifically č (ccaron).

I found out that if you are using utf-8 encoding it's necessary to tell that to MySQL - http://dev.mysql.com/doc/refman/4.1/en/ ... ction.html

So I added these lines to default.inc.php just after connection code (line 90 in v1.2.6 14.12.05) and it solved my problems.

Code: Select all

if ($phpwcms["charset"] == "utf-8") {
	mysql_query("SET NAMES 'utf8'");
}
I'm not sure if this is perfect solution, it works for me.
If somebody else have the same problem - you should try this.

And hopefully this will be fixed in next version ;)

boris
User avatar
Oliver Georgi
Site Admin
Posts: 9903
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

I will proof that - might help.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
gmatyi
Posts: 3
Joined: Tue 31. Jan 2006, 11:11

Post by gmatyi »

Oliver Georgi wrote:I will proof that - might help.

Oliver
Hi Oliver,

I have the same problem: The phpwadmin works properly, If I set iso-8859-2 coding during the installation. The default collation in my my.ini is set to utf-8, therefore you have to change additionally the database collation with phpmyadmin to latin2_hunarian_ci and complete your default.inc.php with the row "mysql_query("SET NAMES 'latin2'");

However I would like use the utf-8 coding, therefore I set it during the installation, the collation the database remains utf8_general_ci, and the completin my default.inc.php is "mysql_query("SET NAMES 'utf8'"); Further I convert all .php files from iso-8859-2 to utf-8, that contain hunarian text., in order to the text on the back and appear properly. I made this process with kate, simple open the php, select coding iso-8859-2, modify all "iso-8859-2" text to "utf-8", and save as with coding utf-8. Exactly this way customized my phpwbb, oscommerce etc.

With the phpwcms there are however trouble, If I do this. In my database there are many hungarian text, these coding are surely utf-8, but boot on the frontend and on the backend appears these text wrong.

I guess, in this case the phpwcms try convert these text between utf-8 and iso-8859-2 or vica versa, since my text are coded utf-8 boot on the database and my frontend, therefore casued trouble....just thinking.


Please see it as soon as possible.

Thanks in advance.
User avatar
Oliver Georgi
Site Admin
Posts: 9903
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

I have implemented the set names stuff. New release will be available soon.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Post Reply