Welcome Guest, Not a member yet? Register   Sign In
Charset/collation acting funny
#1

[eluser]Unknown[/eluser]
Hi there.

I'm testing the CodeIgniter waters (I'm somewhat new to PHP). I have been working on a little web app and made the switch from vanilla PHP to CodeIgniter because I wanted to use some MVC principles and have a little help with security/validation.

Anyway, my test site has some Old Norse throughout it. But at seemingly random times it completely bugs out and gets jumbled up into random characters.

I opened the database config file and set charset to UTF-8 and dbcollat to latin1_swedish_ci (which is what my local mysql install has been using by default). I've tried all kinds of combinations and sometimes things work, sometimes they don't. I've included <meta charset="UTF-8"> in my header template file, and for a time that fixed it.

But I recently rewrote a query in one of my models and it jacked everything up again. I don't know why it would change it. Here's what I changed:
Code:
$this->db->select('*');
$this->db->from('jobs');
$this->db->join('clients', 'clients.id = jobs.clientid');
$this->db->order_by("jobid", "desc");*/
$query = $this->db->get();

# The above code block was changed to the following:

$this->db->select("*");
$this->db->select("date_format(datein, '%M %d, %Y') AS dates", FALSE);
$this->db->from("jobs");
$this->db->join("clients", "clients.id = jobs.clientid");
$this->db->order_by("jobid", "desc");
$query = $this->db->get();

I'm at my wits end on this one. In my old vanilla PHP version of the same app, I never ran into a problem with this. I admit it isn't crucial to have foreign characters, but this is bugging me!




Theme © iAndrew 2016 - Forum software by © MyBB