Solution to MySQL Chinese data garbled in cmd

  • 2020-06-07 05:26:14
  • OfStack

My MySQL is the default encoding of utf8, and the database I built is also set with the encoding of utf8. The application program can add Chinese data, while in cmd string value: '\xB2\xE2\xCA\xD4' column 'title' row 1 error when using SQL statement.

Right click on the border → properties → options at the top of the cmd interface to see that cmd is encoded as GBK, not ES23en-8.

In fact, there is no scrambled code inside the database, but the encoding method of cmd is different from that of cmd. The Chinese data presented in cmd is only scrambled, which also results in the situation that Chinese data cannot be added.

This is not the case with MySQL's GUI management tool.

Related articles: