ERROR 1366 (HY000): Incorrect string value: '\x9B'
Posted by: T Vadla
Date: May 03, 2011 07:12AM

In my MySQL-database I get an 1366 error when I try to insert the letter 'ø'.

I have made everything in my database utf8, so I thought this should do it.

Can anyone tell me what's wrong?

This is how I make the database:

CREATE DATABASE IF NOT EXISTS foodbase_2
CHARACTER SET utf8
COLLATE utf8_general_ci;

USE foodbase_2;

CREATE TABLE IF NOT EXISTS User (
UserId int(4) NOT NULL auto_increment,
Username varchar(15) NOT NULL,
Password varchar(15) NOT NULL,
Firstname varchar(25) NOT NULL,
Lastname varchar(30) NOT NULL,
PRIMARY KEY (UserId),
UNIQUE KEY (Username)
) ENGINE=INNODB;

mysql> set names utf8;

When I try to insert a row through the command shell in Windows I get the following message:

mysql> insert into user values('0000', 'a', 'a', 'a', 'ø');
ERROR 1366 (HY000): Incorrect string value: '\x9B' for column 'Lastname' at row 1

mysql> select lastname, hex(lastname), char(lastname), char_length(lastname) from user;
+----------+---------------+----------------+-----------------------+
| lastname | hex(lastname) | char(lastname) | char_length(lastname) |
+----------+---------------+----------------+-----------------------+
| a | 61 | | 1 |
+----------+---------------+----------------+-----------------------+


mysql> show VARIABLES LIKE '%CHAR%';

--------------------------+---------
Variable_name | Value
--------------------------+---------
character_set_client | utf8
character_set_connection | utf8
character_set_database | utf8
character_set_filesystem | binary
character_set_results | utf8
character_set_server | utf8
character_set_system | utf8
character_sets_dir | C:\Progr...

mysql> show VARIABLES LIKE '%Coll%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+

Options: ReplyQuote


Subject
Views
Written By
Posted
ERROR 1366 (HY000): Incorrect string value: '\x9B'
65281
May 03, 2011 07:12AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.