Page 1 of 1

Problem with inserting Arabic text to the database

Posted: 09 Feb 2018, 13:36
by boris1225
Hi.
I am trying to insert Arabic text to mysql database, but it does not work properly.
I can see only "?????" in the database.
Please help and thanks.

Re: Problem with inserting Arabic text to the database

Posted: 10 Feb 2018, 08:00
by Lapo
Hi,
I am not a MySQL expert but I believe you should look into the "collation" property of your database schema.

See this article:
https://stackoverflow.com/questions/685 ... l-database

Cheers

Re: Problem with inserting Arabic text to the database

Posted: 21 Feb 2018, 14:50
by boris1225
It works properly on local server, but does not work on AWS server.
Smart Fox Server settings and MySQL settings are exactly the same.

Code: Select all

String sql = "UPDATE user SET name='العربية' WHERE id=5";
System.out.println(sql);
try {
dbManager.executeUpdate(sql, new Object[] {});
} catch (SQLException e) {
trace(ExtensionLogLevel.WARN, "SQL Failed: " + e.toString());
}

Result on Smart Fox Console:

Code: Select all

UPDATE user SET name='العربية' WHERE id=5


But looks "?????" in the database.(works correctly "العربية" on local server.)

Re: Problem with inserting Arabic text to the database

Posted: 21 Feb 2018, 15:21
by boris1225

Code: Select all

jdbc:mysql://127.0.0.1:3306/mydb?useUnicode=yes&characterEncoding=UTF-8

This just fixed the issue.
Thanks for your help.

Re: Problem with inserting Arabic text to the database

Posted: 21 Feb 2018, 15:28
by Lapo
The fix suggests that the two mysql servers are not configured exactly the same. I'd recommend comparing the environment variables of both servers if you want to get to the bottom of it, though you've already found a solution :)

Cheers