1

I have an issue with inserting and updating entries with special characters. For example updating: After building the $updateArray I have the following function: public function updateVideo($id, $updateArray) { $this->db->where("ID", $id); return $this->db->update("videos", $updateArray); }

But when a value has a special character, for example á, it updates the database entry with Ã. This is with every special character (éáèà etc.).

I dumped the $updateArray, and the special character is fine there. I echo'd the last query, and it is also fine there. Even if I directly run the last query in phpMyAdmin it is fine. It seems to go wrong after building the query, so when executing it.

The column in phpMyAdmin has latin1_swedish_ci. I have set $config['charset'] = 'iso-8859-1';. The database config also has 'char_set' => 'latin1', 'dbcollat' => 'latin1_swedish_ci'.

Can someone help me pinpoint where I go wrong? Thanks!

Paul Stolk
  • 31
  • 2
  • Maybe this SO answer on setting up UTF-8 will help you find it? https://stackoverflow.com/questions/279170/utf-8-all-the-way-through – ourmandave Sep 17 '17 at 13:56
  • @ourmandave I have followed those steps, but it didnt work. – Paul Stolk Sep 18 '17 at 09:47
  • The weird thing is that it goes right if I manually run the query which CI builds (which I can echo). When CI runs it, it goes wrong though. – Paul Stolk Sep 18 '17 at 09:48

2 Answers2

1

try by changing dbcollat to utf8_unicode_ci

0

The problem was, as most of the time, one small mistake:

Changed this:

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

To:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Paul Stolk
  • 31
  • 2