problem with saving in database

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Toni83
Posts: 7
Joined: 21 Jun 2019, 21:15

problem with saving in database

Postby Toni83 » 01 Jul 2019, 22:12

I have a problem
When a player swears I want it to be stored in the database
But the problem it is saved as question marks
the langauage is : arabic
how can I solve it please?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: problem with saving in database

Postby Lapo » 03 Jul 2019, 07:10

Hi,
both SFS PRO and SFS2X are already configured to work with UTF-8, so all languages are supported out of the box.
When it comes to storing data to a database you need to make sure your database tables support UTF-8

I don't know what DB you're using, if it's MySQL take a look at this article:
https://stackoverflow.com/questions/685 ... l-database

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
Toni83
Posts: 7
Joined: 21 Jun 2019, 21:15

Re: problem with saving in database

Postby Toni83 » 03 Jul 2019, 09:02

Hello,
I'm using mysql and my database tables support UTF-8
The problem isn't in the database because I can add arabic words from the database without any problems.
I programmed sfs to send the swears to the database that the player uses .
The problem is SFS send the arabic swears to the database that the player uses as ???????? (question marks).
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: problem with saving in database

Postby Lapo » 03 Jul 2019, 14:26

If you are using a word filter, then the swear words are replaced with ??? in the chat.
Once this is done, you cannot revert them back to the original. In that case there is no way to maintain the original message, I am sorry.

Maybe what you need to do is intercept the ???? as a signal of someone searing and then you can apply your own logic. Keep in mind that something like this already exists, however. Meaning that SFS2X can already keep count of how many curse words have been sent in one session and either kick the user or banish him/her for a while.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
Toni83
Posts: 7
Joined: 21 Jun 2019, 21:15

Re: problem with saving in database

Postby Toni83 » 03 Jul 2019, 19:20

Am using sfs pro
When the player swears the server kicks him.
But I want the server to send the swears to the database.
The server sends the swears but if the swears are arabic they reach the database as ???????
But if the swears are english they reach the database as they are without any problems.
So the problem is just in the arabic swears when they reach the database they reach as ?????? , what shall I do?
alex2344
Posts: 15
Joined: 30 Oct 2018, 12:04

Re: problem with saving in database

Postby alex2344 » 04 Jul 2019, 01:48

Your issue appears to be unrelated to Smartfoxserver , Please make sure that your database and table collations are set to utf8_general_ci
Toni83
Posts: 7
Joined: 21 Jun 2019, 21:15

Re: problem with saving in database

Postby Toni83 » 04 Jul 2019, 08:17

I said I made sure of that. @alex
I can add arabic words from the database
The problem is in SFS PRO because it sends the arabic words as ????????? to the database
Is there a code to write in "as" files to solve this problem lapo?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: problem with saving in database

Postby Lapo » 04 Jul 2019, 09:17

Hi,
if the chat works in arabic, meaning that people chatting in arabic can read their respective messages, then it's not an issue with the server. If it were you would see bad characters in the chat as well.

Can you show me the details of your Java Runtime? When the server starts up it will log a series of system info, like this:

Code: Select all

jvm 1    | --- [ System Info ] ------------------------------------------
jvm 1    |
jvm 1    | System CPU(s): 2
jvm 1    | VM Max memory: 464 MB
jvm 1    |
jvm 1    | os.name: Linux
jvm 1    | os.arch: amd64
jvm 1    | os.version: 4.15.0-20-generic
jvm 1    | java.version: 1.6.0_11
jvm 1    | java.vendor: Sun Microsystems Inc.
jvm 1    | java.vendor.url: http://java.sun.com/
jvm 1    | java.vm.specification.version: 1.0
jvm 1    | java.vm.version: 11.0-b16
jvm 1    | java.vm.vendor: Sun Microsystems Inc.
jvm 1    | java.vm.name: Java HotSpot(TM) 64-Bit Server VM


Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Toni83
Posts: 7
Joined: 21 Jun 2019, 21:15

Re: problem with saving in database

Postby Toni83 » 04 Jul 2019, 16:50

Code: Select all

--- [ System Info ] ------------------------------------------

System CPU(s): 8
VM Max memory: 517 MB

os.name: Windows Vista
os.arch: x86
os.version: 6.2
java.version: 1.6.0_13
java.vendor: Sun Microsystems Inc.
java.vendor.url: http://java.sun.com/
java.vm.specification.version: 1.0
java.vm.version: 11.3-b02
java.vm.vendor: Sun Microsystems Inc.
java.vm.name: Java HotSpot(TM) Server VM


sfs pro take the arabic information from the database without any problem , because I can log in with an arabic username
but sfs send the arabic information as ??????????
I think I have to define the arabic language the "actionscript" file responsible for sending swears to the database?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: problem with saving in database

Postby Lapo » 05 Jul 2019, 09:34

Hi,
if you can login with an arabic name, it means that the client is sending the correct characters, otherwise it would fail.

I think I have to define the arabic language the "actionscript" file responsible for sending swears to the database?

No, that's unlikely.
Can you show use the code you use to store the massages on the DB?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 38 guests