CodeIgniter Forums
Derek Alard's predictive search and utf-8 encoding - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Derek Alard's predictive search and utf-8 encoding (/showthread.php?tid=32937)



Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]Loquela[/eluser]
Hi there,
I recently downloaded Derek Alard's predictive search application and adapted it to owork as an English to French medical dictionary. Everyting is encoded as utf-8 and the database collation is utf8_unicode_ci, all tables are the same and the data in the tables is all fine. The encoding for the webpages is also utf-8. However, when the app displays the data returned from the database in the webpage, all the French characters and apostrophes are not displaying properly.

Oddly, if I force my browser encoding to western ISO-8859-1, the characters display correctly!

Any advice??

Many thanks.

L.


Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]Clooner[/eluser]
Did you try?
Code:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />



Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]Loquela[/eluser]
Yup,

That's what I meant by:

Quote:...The encoding for the webpages is also utf-8...

Thanks anyway,

L.


Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]crikey[/eluser]
Hi Loquela,

Are you passing your data to the htmlentities() or htmlspecialchars() functions? If so, they'll need extra parameters to make it UTF-8 compatible.

See http://php.net/manual/en/function.htmlspecialchars.php and http://www.php.net/manual/en/function.htmlentities.php.

Hope that helps,
Grant


Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]elrolfe[/eluser]
check if your files are encoded correctly and if the webserver content-encoding is set to utf8.


Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]Loquela[/eluser]
Thanks all,

I'm testing locally using xampp and the non-English characters are encoding/decoding fine in other apps om th esame server. I am using Derek Alard's sample application and all I have done is to change the databse so it references my own dictionary. Everything works fine exept for the encoding:

html headers set to utf-8
all files saved as utf-8
database collation, tables and data encoding to utf-8

I'm baffled.

L.


Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]Clooner[/eluser]
You said you have the database as utf-8 but are you sure you also have the Tables and even the Columns as utf-8?

Edit: Just read you did! Big Grin never mind


Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]Loquela[/eluser]
Oh yes.


Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]InsiteFX[/eluser]
PHPMyAdmin operations see what your main database collation is
set to it defaults to latin1_swedish_ci

InsiteFX


Derek Alard's predictive search and utf-8 encoding - El Forum - 08-10-2010

[eluser]Loquela[/eluser]
Thanks,

Yeah, I keep checking that :-) ...

As stated above in the original post:

Quote:Everyting is encoded as utf-8 and the database collation is utf8_unicode_ci, all tables are the same and the data in the tables is all fine.

And again:

Quote:html
headers set to utf-8
all files saved as utf-8
database collation, tables and data encoding to utf-8

Thanks anyway! :-)