Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

matt's avatar
Level 1

MySQL Error (Encoding) General error: 1366 Incorrect string value

HI,

Got a web spider. Download the contents via CURL, wish to store in my MySQL database. Get the following error:

SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xA3500 -...' for column 'html' at row 1

What I have: In my.cnf:

[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

Confirmed with: show variables like '%collation%';

Variable_name Value
collation_connection utf8mb4_unicode_ci
collation_database utf8mb4_unicode_ci
collation_server utf8mb4_unicode_ci

Laravel config/database.php:

'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',

And the table:

CREATE TABLE `html` (
  `id` int(11) NOT NULL,
  `html` longtext COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Any ideas? Thank you

0 likes
1 reply

Please or to participate in this conversation.