Error Code: 1366. Incorrect string value - MySql stored procedure

Hello friends,

In continuation to the character encoding issues that I have been facing during development of my website AssameseBooks.com, here comes another blog.

The situation goes as follows,
I had the requirement to pull data that were saved in different tables to a single table. The data in the source tables were saved properly in UTF-8 character encoding.
I went through the most simplest approach to do it i.e. write a stored procedure and have the job one.

Well, the moment I executed the stored procedure, I encountered following error i.e.

Error Code: 1366. Incorrect string value: '\xE0\xA6\x85\xE0\xA6\xB8...' for column 'CUSTOM1' at row 1

where custom1 is a column in my database table having the text in assamese font.

Well, the solution was to alter my table and set the character set to UTF8 and collate to utf8_unicode_ci

so the query to be executed to achieve is,

ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Hope this comes handy to you guys too.

Cheers!! and Happy coding :-)

1 comments:

Anonymous said...

saved my day . thanks buddy

Post a Comment