PDA

View Full Version : UTF support revisited


Papuass
01-03-2008, 10:39 PM
I was having problems with certain Latvian characters - lowercase "ā","č" and "ō", to be specific.

It is due to the configuration of my server and database, as I tested these characters on different public pixelpost blogs and they were working correctly (sorry for spam).

In the end I found a solution, I added some lines to functions.php file:

Before

if(!mysql_connect($pixelpost_db_host, $pixelpost_db_user, $pixelpost_db_pass)) {
if($request_uri == 'admin') {
header("Location: install.php?view=db_fix");
exit;
}else{
show_splash("Connect DB Error: ". mysql_error()." Cause #2",$dir);
}
}


After

if(!mysql_connect($pixelpost_db_host, $pixelpost_db_user, $pixelpost_db_pass)) {
if($request_uri == 'admin') {
header("Location: install.php?view=db_fix");
exit;
}else{
show_splash("Connect DB Error: ". mysql_error()." Cause #2",$dir);
}
} else {
mysql_query("SET NAMES 'utf8'");
}

Could someone form devs check out this and maybe include it in codebase as it seems pretty safe change?

These issues were also for version 1.5 and 1.6.

GeoS
01-04-2008, 08:53 AM
Till today there was no case with SET NAMES issue as this should be DB encoding independent so please check if there is any other solution.
It should work without this change and without any problem.

Papuass
01-06-2008, 08:23 PM
I am quite sure that this is the only working solution. Spent some hours debbuging this, before I found that my blogging platform Textpattern does this after connecting to database. I see this as my server configuration fault (running some dozens of sites), but pixelpost should be as portable as possible.

This was also issue for versions 1.5 and 1.6 and was left unfixed (did not report it at that time).