Android Question Help for uploading MySQL database garbled code problem,thank you!

bskotu555

Member
How to handle the situation where the variable nc contains Chinese characters and becomes garbled after uploading to the database?
1730907533627.png

1730907558806.png
 

bskotu555

Member
Please post code as text with code tags.
1730963696450.png
I can manually input Chinese characters into the database, but inserting Chinese characters into the database using B4A will result in garbled characters. I am wondering if I need to transcode them during the insertion process or not?
 
Upvote 0

bskotu555

Member
At post #2 and #5 of this thread, you have been told how to post code. you should read the Forum Guidelines and the "Code Smells" first.

The character set of the mysql server is incorrect, try to change it to utf8mb4


At post #2 and #5 of this thread, you have been told how to post code. you should read the Forum Guidelines and the "Code Smells" first.

The character set of the mysql server is incorrect, try to change it to utf8mb4

B4X:
Dim cx As Int =EditText1.text'ID
        Dim nc As String=EditText2.Text'昵称
        Dim tx As String=EditText3.Text'内容
        sqlstr = "insert into chat(ChatID,Nickname,Text,time) values('" & cx & "','" & nc & "','" & tx & "','" & DateTime.Date(DateTime.Now) & "')"
        Starter.Mysql_Jdbc.ExecNonQuery(sqlstr)
1.png
 
Upvote 0
Top