Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
micruha opened this issue May 26, 2023 · 16 comments
Open

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

micruha opened this issue May 26, 2023 · 16 comments

Comments

@micruha
Copy link

micruha commented May 26, 2023

Здравствуйте.
Подскажите пожалуйста, 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); выводится слово " посетителей.", а до таблицы доходят каракули.

@ChuckBell
Copy link
Owner

ChuckBell commented May 27, 2023 via email

@micruha
Copy link
Author

micruha commented May 27, 2023

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.

@ChuckBell
Copy link
Owner

ChuckBell commented May 27, 2023 via email

@micruha
Copy link
Author

micruha commented May 27, 2023

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?

@ChuckBell
Copy link
Owner

ChuckBell commented May 27, 2023 via email

@micruha
Copy link
Author

micruha commented May 27, 2023

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.

@ChuckBell
Copy link
Owner

ChuckBell commented May 27, 2023 via email

@ChuckBell
Copy link
Owner

ChuckBell commented May 27, 2023 via email

@micruha
Copy link
Author

micruha commented May 27, 2023

Знаете ли вы, какое сопоставление вы используете в 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

@micruha
Copy link
Author

micruha commented May 27, 2023

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.

@ChuckBell
Copy link
Owner

ChuckBell commented May 27, 2023 via email

@micruha
Copy link
Author

micruha commented May 27, 2023

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.

@micruha
Copy link
Author

micruha commented May 27, 2023

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

@micruha
Copy link
Author

micruha commented May 27, 2023

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

@micruha
Copy link
Author

micruha commented May 27, 2023

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

@ChuckBell
Copy link
Owner

ChuckBell commented May 31, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants