The cookie is encoded using the big5 set, and it cannot insert into MySQL. Could you help me to solve this problem?
Fields: username
is eng, date1
The real problem is about the cookie being encoded big5
? Is the rest of the data in the client encoded as utf8
? If 'yes' to both, ...
Change the connection to be big5
, do the INSERT
/SELECT
of the cookie, then change back to utf8 (or, better, utf8mb4 after upgrading).
Executing SET NAMES big5
or calling the charset('big5')
function for the API you are using is the preferred way to switch back and forth.
(Meanwhile, get away from the mysql_*
interface; switch to mysqli_*
or PDO
.)
If everything in the client is big5
, then there is no need to switch back and forth. Simply declare that the client is using big5. Note: It does not matter whether the table/column is also big5; MySQL will convert between them.