MySql doesn’t accept polish letters [Music no 12]

I had a problem to make insert to database like that:

INSERT INTO `Songs` (`Id`, `Name`, `YouTubeUrl`, `PresentationId`) VALUES
(52, 'Będę śpiewał Ci', NULL, '1E4iSSVPJkldnzGT12t8fei4GHz5sTd22H8qPlpycGpQ')

I got an error:

#1366 – Incorrect string value: ‚\xC4\x99d\xC4\x99 …’ for column ‚Name’ at row 1

After small investigation I found out that each column in mysql has itself encoding. To allow polish encoding in column name I had to set encoding to ‚utf8’ or ‚utf8_polish_ci’.

ALTER TABLE Songs MODIFY Name CHAR(50) CHARACTER SET utf8;

1 thought on “MySql doesn’t accept polish letters [Music no 12]”

Leave a Comment

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *