0

I found this weird behaviour using the mysql server 5.6 command line.

If I do:

source C:\Users\dyesdyes\Downloads\test.sql

and the code in this file is:

insert into `tWord`(`word`,`frequency`) values 
('à',16994.68);

The SQL to create the tWord table is:

CREATE TABLE IF NOT EXISTS `tWord` (
  `idWord` INT(11) NOT NULL AUTO_INCREMENT,
  `word` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL,
  `frequency` DOUBLE NULL DEFAULT NULL,
  PRIMARY KEY (`idWord`),
  UNIQUE INDEX `idWord_UNIQUE` (`idWord` ASC),
  INDEX `word` (`word` ASC),
  INDEX `idWord` (`idWord` ASC))
ENGINE = InnoDB
AUTO_INCREMENT = 0
DEFAULT CHARACTER SET = utf8;

The error is:

ERROR 1366 (HY000): Incorrect string value: '\xE0' for column 'word' at row 1

If I execute the same insert statement in the workbench client, it works fine. It only gives an error using the command line...

Any hint?

2
  • 3
    are you sure your .sql file is encoded using UTF8? Commented Sep 9, 2014 at 22:09
  • that's the issue! Make it an answer. Commented Sep 9, 2014 at 22:24

1 Answer 1

1

.sql file should be UTF8 encoded. Text editor should have a setting to save it that way.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.