You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Вместо слова " посетителей." в таблицу записывается " поÑ�етителей."
В мониторинге порта Serial.println(query); выводится слово " посетителей.", а до таблицы доходят каракули.
On May 26, 2023, at 4:07 AM, micruha ***@***.***> wrote:
Здравствуйте.
Подскажите пожалуйста, 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); выводится слово " посетителей.", а до таблицы доходят каракули.
—
Reply to this email directly, view it on GitHub <#213>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB6SHYBAEHXPA4EBXRXWLNDXIBQE5ANCNFSM6AAAAAAYP4GI6E>.
You are receiving this because you are subscribed to this thread.
Instead of the word " посетителей.", the table is written " Ð¿Ð¾Ñ ÐµÑ‚Ð¸Ñ‚ÐµÐ»ÐµÐ¹."
In port monitoring Serial.println(query); the word " посетителей." is displayed, and doodles reach the table.
Hi. I have not tried the Russian language, but if MySQL is configured to support it and the chars are 1-byte each, it should work, but I know it does not support 2-byte chars.
On May 27, 2023, at 1:17 PM, micruha ***@***.***> wrote:
Hello.
Please tell me, does MySQL_Connection support sending queries with words in Russian?
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 " visitors.", the table is written " Ð¿Ð¾Ñ ÐµÑ‚Ð¸Ñ‚ÐµÐ»ÐµÐ¹."
In port monitoring Serial.println(query); the word " visitors" is displayed.", and doodles reach the table.
—
Reply to this email directly, view it on GitHub <#213 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB6SHYHFUMT5EFBMX4MXYZTXIIZMHANCNFSM6AAAAAAYP4GI6E>.
You are receiving this because you commented.
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?
On May 27, 2023, at 1:28 PM, micruha ***@***.***> wrote:
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?
—
Reply to this email directly, view it on GitHub <#213 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB6SHYATUUBOLLPFXOMCLBDXII2THANCNFSM6AAAAAAYP4GI6E>.
You are receiving this because you commented.
Basically, open MySQL_Packet.cpp and change line#122 to set the charset number from 08 to whatever you want. For example, the following are the Cyrillic charsets that MySQL supports.
mysql> SELECT id, collation_name FROM information_schema.collations WHERE collation_name like '%1251%' ORDER BY id;
+----+---------------------+
| id | collation_name |
+----+---------------------+
| 14 | cp1251_bulgarian_ci |
| 23 | cp1251_ukrainian_ci |
| 50 | cp1251_bin |
| 51 | cp1251_general_ci |
| 52 | cp1251_general_cs |
+----+---------------------+
5 rows in set (0.00 sec)
For example, suppose your desired charset if cp1251_general_ci, which is id = 51. We convert it to hex (0x33) and change:
// charset - default is 8
buffer[size_send] = byte(0x08);
To:
// charset - default is 8
buffer[size_send] = byte(0x33); // cp1251_general_ci
This should work and worth a try. If you get a chance to try it, let me know if it works. If it does, I will put it on the list for the next revision.
On May 27, 2023, at 3:01 PM, Charles Bell ***@***.***> wrote:
Do you know which collation you are using in MySQL? If you can identify a charset/collation, I may be able to suggest a quick hack to make it work. Is it one of these? If so, which one?
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.
>
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.
On Sat, May 27, 2023 at 15:34 micruha ***@***.***> wrote:
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.
—
Reply to this email directly, view it on GitHub
<#213 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB6SHYC4KLC6V36LE3T54KLXIJJMBANCNFSM6AAAAAAYP4GI6E>
.
You are receiving this because you commented.Message ID:
***@***.***>
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.
The connector can be altered to support Russian. Here’s how you do it. It’s a multi-step process.
First, modify MySQL_Packet.cpp as suggested only use 0x24 (for charset cp866).
buffer[size_send] = byte(0x24);
Next, create (or alter) your table to use that character set and default collation for the column(s) you want to support.
CREATE TABLE test.lang (a int auto_increment primary key, b char(40) charset cp866 collate cp866_general_ci);
Next, change the charset in the MySQL monitor (mysql) to use the new charset.
mysql> \C cp866
Charset changed
Finally, execute your script. I wrote a simple INSERT to use the phrase, “правильная фраза”.
Observe:
mysql> select * from test.lang;
+---+---------------------------------+
| a | b |
+---+---------------------------------+
| 1 | правильная фраза |
+---+---------------------------------+
1 row in set (0.00 sec)
Done. :)
Activity
ChuckBell commentedon May 27, 2023
micruha commentedon 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 commentedon May 27, 2023
micruha commentedon 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 commentedon May 27, 2023
micruha commentedon 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 commentedon May 27, 2023
ChuckBell commentedon May 27, 2023
micruha commentedon May 27, 2023
micruha commentedon 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 commentedon May 27, 2023
micruha commentedon 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 commentedon May 27, 2023
I'm sitting now, trying to understand your answer and change the sketch code.

micruha commentedon May 27, 2023
That's it, got it. I'll check it out now.
micruha commentedon May 27, 2023
buffer[size_send] = byte(0x33); it didn't work. Signed up for the table - Maximum: 16 посетителей.

ChuckBell commentedon May 31, 2023