Derek Alard's predictive search and utf-8 encoding |
[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.
[eluser]Clooner[/eluser]
Did you try? Code: <meta http-equiv="content-type" content="text/html; charset=utf-8" />
[eluser]Loquela[/eluser]
Yup, That's what I meant by: Quote:...The encoding for the webpages is also utf-8... Thanks anyway, L.
[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
[eluser]elrolfe[/eluser]
check if your files are encoded correctly and if the webserver content-encoding is set to utf8.
[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.
[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! never mind
[eluser]InsiteFX[/eluser]
PHPMyAdmin operations see what your main database collation is set to it defaults to latin1_swedish_ci InsiteFX
[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 Thanks anyway! :-) |
Welcome Guest, Not a member yet? Register Sign In |