0

I am working with MySQL server, where I need to write/read some content contains latin characters like čćšž, but for some reason my database can not store č and ć characters.

As far as I know those characters should belong inside utf8_general_ci.

I added this to my.cnf file:

[mysqld]  
init_connect='SET collation_connection = utf8_general_ci'  
init_connect='SET NAMES utf8'  
character-set-server=utf8  
collation-server=utf8_general_ci  
skip-character-set-client-handshake

Take a look at this picture with all encoding:

enter image description here

I use SOURCE command to import my database to server. Here is content of SQL dump:

SET NAMES utf8;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`horoskopium`  DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

USE `horoskopium`;

/*Table structure for table `day` */

DROP TABLE IF EXISTS `day`;

CREATE TABLE `day` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `text` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=utf8;

/*Table structure for table `love` */

DROP TABLE IF EXISTS `love`;

CREATE TABLE `love` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `text` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8;

/*Table structure for table `month` */

DROP TABLE IF EXISTS `month`;

CREATE TABLE `month` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `text` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;

/*Table structure for table `week` */

DROP TABLE IF EXISTS `week`;

CREATE TABLE `week` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `text` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

How I can solve this?

Zookey
  • 2,637
  • 13
  • 46
  • 80

1 Answers1

1

You should use utfmb4. I'm pretty sure it'll fix this.

https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html

Utf8_general_ci or utf8mb4 or...?

Community
  • 1
  • 1
Maktouch
  • 3,117
  • 20
  • 21