Problem with inserting Arabic text to the database

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

boris1225
Posts: 3
Joined: 09 Feb 2018, 13:16

Problem with inserting Arabic text to the database

Postby boris1225 » 09 Feb 2018, 13:36

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.
User avatar
Lapo
Site Admin
Posts: 20392
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Problem with inserting Arabic text to the database

Postby Lapo » 10 Feb 2018, 08:00

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
Lapo
--
gotoAndPlay()
...addicted to flash games
boris1225
Posts: 3
Joined: 09 Feb 2018, 13:16

Re: Problem with inserting Arabic text to the database

Postby boris1225 » 21 Feb 2018, 14:50

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.)
boris1225
Posts: 3
Joined: 09 Feb 2018, 13:16

Re: Problem with inserting Arabic text to the database

Postby boris1225 » 21 Feb 2018, 15:21

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.
User avatar
Lapo
Site Admin
Posts: 20392
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Problem with inserting Arabic text to the database

Postby Lapo » 21 Feb 2018, 15:28

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
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 17 guests