I take the text from the German site in the encoding Encoding.GetEncoding("iso-8859-1");

I put in MySQL (5.6.31) the coding of the server UTF-8 Unicode (utf8). There, the default column is defined with latin1_swedish_ci.

After the program, I take the text, and send a request (to the Yandex translator) and get an XML structure in response, while I set the encoding:

  private string Download(string link) // Метод получения xml структуры { downloader.Encoding = Encoding.UTF8; return downloader.DownloadString(link); } 

Then, I digest the resulting structure and put the translation into a new column, but instead of Russian letters, question marks ?????

Tried to change the encoding of the column or the translation does not help. Also added to the connection charset, also does not work. To connect using the connector Mysql MySql.Data.MySqlClient;

  • Do it differently. From the German site -> Yandex. Translator -> from the Yandex response, the original and translation -> MySQL -> extract & check. - Bulson
  • @Bulson Anyway question marks - creamsun
  • then it looks like the MySQL settings. And if you just take the Russian text, the database stores normally? And why, by the way, the installation is done in Swedish. (latin1_swedish_ci.)? - Bulson
  • @Bulson 2 columns with 2 encodings with utf8 and 1251, still signs ??? - creamsun
  • Perhaps this will help: stackoverflow.com/questions/6646949/… Maybe you are confusing collation and charset? - ExUser

1 answer 1

The solution turned out to be trivial, which helps everyone:

For the table, set the encoding

 utf8_general_ci 

To connect to the database:

 mysql.CharacterSet = "utf8";