How to exchange a charset from a table to utf8 in a latin1 database?

Asked

Viewed 1,026 times

1

I am trying to change the charset of a table to utf8 in a BD that contains all other tables like latin1swedish. I ran several commands and says it changed, it shows that that table is the only one as utf8, but any insertion keeps giving errors.

For example, I insert into the field endereco table coordenadas_cache, something like: São Sebastião

When I look at phpMyAdmin, it’s: São Sebastião

What can I do?

  • Ever tried to make a regex for correction?

  • No, I don’t know what that is. What that would be like?

1 answer

2


Well, I managed to solve it. How I use mysqli_connect() to connect to the BD, I happened to discover that it has a command that arrow the charset (for sending, I suppose) of the insertion query. The command is the $mysqli->set_charset("utf8"), being $mysqli the variable used to connect to the database in the command $mysqli = mysqli_connect("myhost","myuser","mypassw","mybd")

Browser other questions tagged

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