JoaoPedroCG Posted July 22, 2015 Share Posted July 22, 2015 Hey everyone! I'm posting here today because I have a HUGE problem and need help to resolve this ASAP.. Here it goes: I have a database that have some rows already; I was asked to do a "DB management website" for that DB; the only problem is that when I fetched the rows from the database to display onto the website, the utf-8 errors start to appear: 1º characters like "ã" and "á" become different things (a square with a ? in them) 2º when I try to insert values from the website to the database, it happens the same thing.. I have used utf8_decode and utf8_encode but nothing has worked out for me.. Thanks in advance for your patience and sorry for my English not being the best to explain the problem.. Quote Link to comment Share on other sites More sharing options...
dalecosp Posted July 22, 2015 Share Posted July 22, 2015 Inspect the headers being sent by your webserver ... is it sending UTF-8? Quote Link to comment Share on other sites More sharing options...
requinix Posted July 22, 2015 Share Posted July 22, 2015 - The table columns (the text ones) need to be in utf8 format - The table itself and the database should also have it as the default encoding - You need to be connected to the database using utf8 encoding before any data is exchanged - Your code needs to treat all strings as multibyte strings - that means no strlen() or substr() (and others) and instead using the mbstring extension's equivalents - Your Content-Type response header and/or webpages need to mention the utf-8 encoding Quote Link to comment Share on other sites More sharing options...
JoaoPedroCG Posted July 23, 2015 Author Share Posted July 23, 2015 I have all of that :s Quote Link to comment Share on other sites More sharing options...
requinix Posted July 23, 2015 Share Posted July 23, 2015 Then what do SHOW CREATE TABLE whatever_your_table_is SHOW VARIABLES LIKE '%char%'output? And is this site somewhere we can look at? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.