I have some MySQL Character Set Error. I'm Korean, So I need put Korean in MySQL Server. but I can't. I changed all character set, and send query "SET NAMES UTF8MB4" but My Program print again Same Error.
I try put "테스트" And Insert Into In Program (Pawn Language)
FormatEx(Query, sizeof(Query), "INSERT INTO %s_bans (type, ip, name, created, ends, length, reason, aid, adminIp, sid, country) VALUES \
(1, '%s', '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + %d, %d, '%s', (SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$'), '%s', \
(SELECT sid FROM %s_servers WHERE ip = '%s' AND port = '%s' LIMIT 0,1), ' ')",
DatabasePrefix, ip, (minutes * 60), (minutes * 60), banReason, DatabasePrefix, adminAuth, adminAuth[8], adminIp, DatabasePrefix, ServerIp, ServerPort);
I try many search and test, I can't fix this error. Thanks!
Server OS : Ubuntu Server 16.04.3 64bit
MySQL Error :
L 09/11/2017 - 20:18:22: [sbpp_main.smx] Verify Insert Query Failed: Incorrect string value: '\xED \x85 \x8C ...' for column 'reason' at row 1
show variables like 'char%'; :
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
show create table sb_bans (Target Table) :
| sb_bans | CREATE TABLE `sb_bans` (
`bid` int(6) NOT NULL AUTO_INCREMENT,
`ip` varchar(32) DEFAULT NULL,
`authid` varchar(64) NOT NULL DEFAULT '',
`name` varchar(128) NOT NULL DEFAULT 'unnamed',
`created` int(11) NOT NULL DEFAULT '0',
`ends` int(11) NOT NULL DEFAULT '0',
`length` int(10) NOT NULL DEFAULT '0',
`reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`aid` int(6) NOT NULL DEFAULT '0',
`adminIp` varchar(32) NOT NULL DEFAULT '',
`sid` int(6) NOT NULL DEFAULT '0',
`country` varchar(4) DEFAULT NULL,
`RemovedBy` int(8) DEFAULT NULL,
`RemoveType` varchar(3) DEFAULT NULL,
`RemovedOn` int(10) DEFAULT NULL,
`type` tinyint(4) NOT NULL DEFAULT '0',
`ureason` text,
PRIMARY KEY (`bid`),
KEY `sid` (`sid`),
FULLTEXT KEY `reason` (`reason`),
FULLTEXT KEY `authid_2` (`authid`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 |
MySQL Status :
mysql Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using EditLine wrapper
Connection id: 54
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.19-0ubuntu0.16.04.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 18 min 43 sec
Threads: 7 Questions: 1697 Slow queries: 0 Opens: 203 Flush tables: 1 Open tables: 118 Queries per second avg: 1.511
mysqld.cnf
[mysqld]
character-set-client-handshake=FALSE
init_connect="SET collation_connection = utf8mb4_general_ci"
init_connect="SET NAMES utf8mb4"
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
[client]
default-character-set=utf8mb4
mysql.cnf
[mysql]
default-character-set = utf8mb4
mysqldump.cnf
[mysqldump]
default-character-set = utf8mb4
Not enough info -- "print again Incorrect String Value"
테스트
indicates Mojibake?????????
indicates something else.See this for details about each.
Note:
root
(or anySUPER
user) does not runinit_connect
. Whenever developing a database-based app, provide a non-root login.In the error text,
\xED \x85 \x8C
, where there actually spaces as indicated? (utf8테
is hexED858C
.) Where doesFormatEx
come from? Could it be thatFormatEx
inserted spaces??