Skip to content

Слова на русском языке. #213

Open

Description

@micruha

Здравствуйте.
Подскажите пожалуйста, MySQL_Connection поддерживает отправку запросов со словами на русском языке?

void loop() {
int value = random(101);
String event_caption = String(shop_name) + ": " + String(value) + " посетителей.";
String event_message = String(shop_name) + ": " + String(value) + " посетителей.";
MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);
char query[512];
sprintf(query, INSERT_DATA, db_name, table_name, event_caption.c_str(), event_message.c_str());
Serial.println(query);
cur_mem->execute(query);
delete cur_mem;
delay(60000);
}

Вместо слова " посетителей." в таблицу записывается " поÑ�етителей."
В мониторинге порта Serial.println(query); выводится слово " посетителей.", а до таблицы доходят каракули.

Activity

  1. ChuckBell commented on May 27, 2023

    @ChuckBell
    Owner
  2. micruha commented on May 27, 2023

    @micruha
    Author

    Hello.
    Please tell me, does MySQL_Connection support sending queries with words in Russian?


    char db_name[] = "testdatabase";
    char table_name[] = "org_events";
    char shop_name[] = "Maximum"; //Пока только на английском языке.
    char INSERT_DATA[] = "INSERT INTO %s.%s (event_caption, event_type, start_date, finish_date, label_color, event_message, event_options, recurrence_idx, reminder_date, reminder_min_before_start, resource_id, event_state, doc_id, project_id) VALUES ('%s', 0, CURDATE(), DATE_ADD(CURDATE(), INTERVAL 1 DAY), '536870912', '%s', 3, -1, NOW(), 15, 0, 0, 0, 1)";

    void loop() {
    int value = random(101);
    String event_caption = String(shop_name) + ": " + String(value) + " посетителей.";
    String event_message = String(shop_name) + ": " + String(value) + " посетителей.";
    MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);
    char query[512];
    sprintf(query, INSERT_DATA, db_name, table_name, event_caption.c_str(), event_message.c_str());
    Serial.println(query);
    cur_mem->execute(query);
    delete cur_mem;
    delay(60000);
    }

    Instead of the word " посетителей.", the table is written " Ð¿Ð¾Ñ ÐµÑ‚Ð¸Ñ‚ÐµÐ»ÐµÐ¹."
    In port monitoring Serial.println(query); the word " посетителей." is displayed, and doodles reach the table.

  3. ChuckBell commented on May 27, 2023

    @ChuckBell
    Owner
  4. micruha commented on May 27, 2023

    @micruha
    Author

    Russian Russian letters are freely supported by MySQL, and in Serial.println(query); text with Russian letters is displayed, which is sent to the table, and incorrectly interpreted characters are written to the table. Is there any plans to support Russian letters?

  5. ChuckBell commented on May 27, 2023

    @ChuckBell
    Owner
  6. micruha commented on May 27, 2023

    @micruha
    Author

    I'm not good at programming. Everything I can do is thanks to ChatGPT, but all the advice he gives me on fixing my code doesn't work.

  7. ChuckBell commented on May 27, 2023

    @ChuckBell
    Owner
  8. ChuckBell commented on May 27, 2023

    @ChuckBell
    Owner
  9. micruha commented on May 27, 2023

    @micruha
    Author

    Знаете ли вы, какое сопоставление вы используете в MySQL? Если вы можете определить кодировку/сопоставление, я могу предложить быстрый хак, чтобы заставить его работать. Это один из них? Если да, то какой? https://dev.mysql.com/doc/refman/8.0/en/charset-cyrillic-sets.html
    …
    On May 27, 2023, at 1:35 PM, micruha @.***> wrote: I'm not good at programming. Everything I can do is thanks to ChatGPT, but all the advice he gives me on fixing my code doesn't work. — Reply to this email directly, view it on GitHub <#213 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYCOMAMNWAUOAASM7VTXII3OZANCNFSM6AAAAAAYP4GI6E. You are receiving this because you commented.

    image

  10. micruha commented on May 27, 2023

    @micruha
    Author

    I can't change anything in the MySQL database, because a trade accounting program works with its tables. If I change MySQL parameters, then my program stops working correctly. I am assembling an Arduino device that sends some data to the MySQL database tables of the program. I adjust my device to the DB, not the DB to my device.

  11. ChuckBell commented on May 27, 2023

    @ChuckBell
    Owner
  12. micruha commented on May 27, 2023

    @micruha
    Author

    I'm sorry, I didn't understand you. I'm not a programmer and I don't understand many terms. I need time to understand what you wrote to me. I will study all your answers and come back with the results.

  13. micruha commented on May 27, 2023

    @micruha
    Author

    I'm sitting now, trying to understand your answer and change the sketch code.
    WhatsApp Image 2023-05-28 at 02 47 59

  14. micruha commented on May 27, 2023

    @micruha
    Author

    That's it, got it. I'll check it out now.

  15. micruha commented on May 27, 2023

    @micruha
    Author

    buffer[size_send] = byte(0x33); it didn't work. Signed up for the table - Maximum: 16 посетителей.
    image

  16. ChuckBell commented on May 31, 2023

    @ChuckBell
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions