S
S
Sailaubai Shyngys2015-06-26 22:41:07
WordPress
Sailaubai Shyngys, 2015-06-26 22:41:07

What encoding does PDO use?

Thanks in advance.
Recently started using PDO to work with MySQL. And immediately a problem. If everything is requested and added via php, then it's fine. But if you look in phpmyadmin or mysql workbench, then there are hieroglyphs.
2c7d9ac6976e4324b161fec35dc9ce0f.jpg
this is how php shows it. And adds what you need. But this is how phpmyadmin shows
6b92b8acf263434181c8be7f79ad89fb.jpg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ice, 2018-10-05
@IceRD

You need to add an entry in the server settings.
for example CentOS /etc/httpd/conf.d/ your config
https://developer.mozilla.org/en-US/docs/Web/HTTP/...
Note: Setting the meta tag is useless! For instance, has no effect. Don't use it! Only by setting through the HTTP header like the examples below, X-Frame-Options will work.
I will translate a little for you "Installing the meta tag is useless!"

S
SagePtr, 2015-06-26
@chyngys

By default - none (the MySQL server will choose, most likely it will be latin1). Therefore, you need to manually prescribe the encoding either in the connection string, or for older versions of PHP (before 5.3.6 it seems) - the set names request, as usual.

P
Pavel Gogolinsky, 2015-06-27
@gogolinsky

Try creating a new db with phpmyadmin. When creating, specify Utf-8 general_ci encoding. Everything should be normal

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question