Solved Mysql with UTF-8

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Spartan9802

Member
Jan 26, 2017
158
8
18
Hello i have problem
I use the mysql with SkQuery, my symbol is modified for "?" in database :/
 
MySQL 4.1 and above has a default character set of UTF-8. You can verify this in your my.cnf file, remember to set both client and server (default-character-set and character-set-server).

If you have existing data that you wish to convert to UTF-8, dump your database, and import it back as UTF-8 making sure:

  • use SET NAMES utf8 before you query/insert into the database
  • use DEFAULT CHARSET=utf8 when creating new tables
  • at this point your MySQL client and server should be in UTF-8 (see my.cnf). remember any languages you use (such as PHP) must be UTF-8 as well. Some versions of PHP will use their own MySQL client library, which may not be UTF-8 aware.
If you do want to migrate existing data remember to backup first! Lots of weird choping of data can happen when things don't go as planned!

Also, Make sure to go into your server starter bat file, and add "-Dfile.encoding=UTF-8" to it. This means, Console can see and use UTF8 text.

code_language.skript:
java  -Xms4G -Dfile.encoding=UTF-8 -jar spigot.jar -o true
PAUSE
 
Thank you for your reply, I have no problem with php just under skript here my code
code_language.skript:
update "UPDATE `%{_key}%` SET `numbers`='%amount of {_item.%loop-number%}%', `id`='%{_id.%loop-number%}%', `data`='%{_data.%loop-number%}%', `nbt`='%{_nbt.%loop-number%}%'  WHERE `slot` ='%loop-number%'"
[doublepost=1495319230,1495308343][/doublepost]My error java:
Java:
java.sql.SQLException: Incorrect string value: '\xE2\x9C\xAD \xC2\xA7...' for column 'nbt' at row 1
21.05 00:27:00 [Server] WARN at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
21.05 00:27:00 [Server] WARN at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)
21.05 00:27:00 [Server] WARN at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)
21.05 00:27:00 [Server] WARN at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
21.05 00:27:00 [Server] WARN at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
21.05 00:27:00 [Server] WARN at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)
21.05 00:27:00 [Server] WARN at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1662)
21.05 00:27:00 [Server] WARN at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1581)
21.05 00:27:00 [Server] WARN at com.w00tmast3r.skquery.elements.effects.EffSQLUpdate.execute(EffSQLUpdate.java:32)
21.05 00:27:00 [Server] WARN at ch.njol.skript.lang.Effect.run(Effect.java:54)
21.05 00:27:00 [Server] WARN at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:65)
21.05 00:27:00 [Server] WARN at sun.reflect.GeneratedMethodAccessor436.invoke(Unknown Source)
21.05 00:27:00 [Server] WARN at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
21.05 00:27:00 [Server] WARN at java.lang.reflect.Method.invoke(Method.java:498)
21.05 00:27:00 [Server] WARN at com.w00tmast3r.skquery.elements.effects.EffOptionThread$2.call(EffOptionThread.java:61)
21.05 00:27:00 [Server] WARN at com.w00tmast3r.skquery.elements.effects.EffOptionThread$2.call(EffOptionThread.java:58)
21.05 00:27:00 [Server] WARN at java.util.concurrent.FutureTask.run(FutureTask.java:266)
21.05 00:27:00 [Server] WARN at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
21.05 00:27:00 [Server] WARN at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
21.05 00:27:00 [Server] WARN at java.lang.Thread.run(Thread.java:748)
[doublepost=1495359082][/doublepost]Plz help me :/
 
xD
[doublepost=1495483868,1495401022][/doublepost]OKey my problem is solved, just convert my table and database to utf8mb4_unicode_ci with this:
code_language.skript:
$ thread
update "ALTER TABLE `%{_key}%` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
 
  • Like
Reactions: Adrihun
Status
Not open for further replies.