A
A
Alexander2014-05-27 19:26:33
PHP
Alexander, 2014-05-27 19:26:33

How to solve access to mysql encoding problem using php?

There is an access database, you need to transfer one of the tables to mysql using php, everything works out, but instead of Russian words, there is a problem with the encoding. I don’t know how to fix it.
The encoding in mysql is UTF-8, I also tried cp-1251, in the first case there are cracks, in the second there are question marks ....
UPD. Solved the problem, added to my.cnf

[mysqld]
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_general_ci
init-connect="SET NAMES utf8"
skip-character-set-client-handshake

[mysqldump]
default-character-set=utf8

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander, 2014-05-27
@unix0

did it already (
the joke is that if you output it as an echo - the encoding is normal ...
and if you send it to mysql, then it's cracked ... cracked in the database itself
------
corrected the encoding in my.cnf, everything worked

I
IceJOKER, 2014-05-27
@IceJOKER

mysql_query("set names 'utf-8'");
and also to the top of the page if php:

header('Content-Type: text/html; charset = 'utf-8'');

S
Stepan, 2014-05-27
@L3n1n

See what encoding is in the table settings and in the settings of each field.
634464aa91114d46b6e1ea3f10a06793.png

R
rdev, 2014-05-27
@rdev

most likely the browser itself exposes the necessary encoding.
as a last resort, you can make iconv for all fields

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question