Jump to content

UTF-8 from BD doesn't match UTF-8 from website


JoaoPedroCG

Recommended Posts

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..

- 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.