0

I'm using Feed Importer to import data from a csv file, and I got this error

SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xA0 a TN...' for column 'message' at row 1

All values are in english characters, and I really don't know how to solve this problem

Help please. thanks

1

If you got the error while using the db_insert then you can use the following code

$val = mb_check_encoding($val, 'UTF-8') ? $val : utf8_encode($val);

if it is just matter of one field value.

5

What is the origin of your CSV file? Are you sure that it is properly encoded using UTF-8? This error is coming from an issue with the database handler trying to process non-UTF8 characters (see: http://drupal.org/node/1140194).

The particular character it is having problems according to your error above is the "&nsbp;" character or 0xC2 and 0xA0, you'' want to convert your file to UTF-8 or alternatively if you have control over what ever is generating your export, strip it out using php following the advice here

  • I tried opening it up in notepad and saved it in UTF-8, but it says the file it's unwritable when I import from the modified file. – lusketeer Jul 3 '12 at 16:50
  • You likely messed something up when you saved it out. The encoding issue can be a real pain. If you don't have the source encoding right, converting to UTF-8 won't do mush (it has to know what to convert from). Very often, I just search/replace these bad characters with Notepad++. – mpdonadio Jul 3 '12 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.