Golang MySQL string insertion error

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Incorrect string value: ' \xef\xbf\xbd\xef\xbf\xbd ... '

Report this error, basically is the coding problem, check the table code

Show CREATE TABLE table_name;

For example, the problem is the character set

| gosignal | CREATE TABLE ' gosignal ' (
' id ' int (one) DEFAULT NULL,
' Time ' varchar (+) DEFAULT NULL,
' IMSI ' varchar DEFAULT NULL,
' IMEI ' varchar (+) DEFAULT NULL,
' Duration ' int (one) DEFAULT NULL,
' Startlac ' varchar DEFAULT NULL,
' STARTCI ' varchar DEFAULT NULL,
' Endlac ' varchar DEFAULT NULL,
' ENDCI ' varchar DEFAULT NULL,
' Cause ' varchar (5) DEFAULT NULL,
' Fromnum ' varchar (+) DEFAULT NULL,
' Tonum ' varchar (+) DEFAULT NULL,
' STARTLNG ' double DEFAULT NULL,
' Startlat ' double DEFAULT NULL,
' ENDLNG ' double DEFAULT NULL,
' Endlat ' double DEFAULT NULL
) Engine=innodb DEFAULT charset=latin1 |

Modify method

ALTER TABLE gosignal convert to character set UTF8;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.