Strange characters saved in MYSQL

Asked

Viewed 280 times

0

My system is powered by an XML file every day. When saving to the database, Mysql saves one way and when rescuing this data using PHP it is displaying on the page as follows:

inserir a descrição da imagem aqui

Being that in these "crazy" characters, it’s just a simple "-.". inserir a descrição da imagem aqui

Does anyone have any idea what it is?

  • Josivan, put at the beginning of the PHP pages that load the database data this statement: header('Content-Type: text/html; charset=utf-8'); - For me it solves.

  • The problem, @Rodrigotognin, is not even that. It is that I want to carry out queries in the database, for example, I want to take the "SPECIAL COURTS CIVIL AND CRIMINAL -. CAPITAL - JUDICIARIO" and search in the database, however, when I do the search nothing returns me.

  • The database charset is utf8-default collation

  • I believe that in your case changing (-.) to only (- ) without the 'stitch together' would not give charset problem, because I believe you are trying to identify (-.) as being a symbol

  • In fact this would solve, but it is not feasible, because the file has a lot of data.

1 answer

0

The database also has the charset set set. Probably your database field saved in another format. But it would be necessary to know how you perform search through the code. Only with the example is not possible to help you.

  • So the XML encoding is 'ISO-8859-1' and my database is UTF-8. When performing a simple search, mysql returns as follows "SPECIAL CIVIL AND CRIMINAL COURTS -. CAPITAL - JUDICIAL" (this by PHP), however, if I perform a consultation with a Where orgao = "SPECIAL CIVIL AND CRIMINAL COURTS -. CAPITAL - JUDICIAL"he brings me no results.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.