Bad accents when exporting with data

lotiara's profile image lotiara posted 3 weeks ago in Import/Export Permalink

Hi All Using Heidsql 12.15.0.7171 with Mariadb Exporting the db including data, the file is UTF8 but special characters like í ó á etx are not exported correclty even in the Db they are correct. Is thers anything i can do ? Thank you.

ansgar's profile image ansgar posted 3 weeks ago Permalink

Double check the file encoding with a different text editor, if not done already. The SQL export always uses UTF-8 encoding for the result file.

Just to be sure, you are using Tools > "Export database as SQL", and "Output" set to "Single file". Right?

lotiara's profile image lotiara posted 3 weeks ago Permalink

Hi, its UTF8 without doubt. I export using the tree (mouse right clik) , not utils, I choose what i want to export and output to single file.

lotiara's profile image lotiara posted 3 weeks ago Permalink

In table view, Export grid rows to clipboard OR file works correclty.

ansgar's profile image ansgar posted 3 weeks ago Permalink

In that case there may be some mismatch with the charsets of your tables. Can you post the CREATE TABLE code of one relevant table here, so I can try to reproduce?

Also, please ensure your HeidiSQL session does not run some charset alteration in an autostart script (Session manager > Advanced)

lotiara's profile image lotiara posted 3 weeks ago Permalink

This is the table

-- Dumping structure for table DATOS_L12.tags
CREATE TABLE IF NOT EXISTS `tags` (
  `id` smallint unsigned NOT NULL,
  `pantalla_dcs` varchar(50) DEFAULT NULL,
  `linea` varchar(7) DEFAULT NULL,
  `tags_dcs` varchar(30) DEFAULT NULL,
  `descripcion` varchar(100) DEFAULT NULL,
  `valor_min` double DEFAULT NULL,
  `valor_max` double DEFAULT NULL,
  `unidades` varchar(10) DEFAULT NULL,
  `tipo_dato` varchar(11) DEFAULT NULL,
  `limite_alarma_bajo` varchar(6) DEFAULT NULL,
  `limite_alarma_alto` varchar(6) DEFAULT NULL,
  `limite_bajo_operacion` double DEFAULT NULL,
  `limite_alto_operacion` double DEFAULT NULL,
  `nombre_objeto_opc_server_800xa` varchar(500) DEFAULT NULL,
  `grupo_de_muestreo` smallint DEFAULT NULL,
  `informe` varchar(200) DEFAULT NULL,
  `intervalo` mediumint unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

I do not have Startup Script. Thabk you

ansgar's profile image ansgar posted 3 weeks ago Permalink

Just created that table on my local MariaDB 10.3. My first inspection was my server converted your charset=utf8mb3 to charset=utf8, and my MariaDB server supports the newer utf8mb4, so utf8mb3 may be an issue on your side.

Notepad++ detects the output file correctly and displays german umlauts and some of yours which I copied into the table correctly:

grafik.png

lotiara's profile image lotiara posted 3 weeks ago Permalink

I also use Mariadb

This did the trick.

ALTER TABLE tags CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci;

Thank you for your help.

ansgar's profile image ansgar posted 3 weeks ago Permalink

Super, glad you found a fix. That ALTER TABLE definitely looks right. Similar to what HeidiSQL does with the "Convert data" checkbox in the table editor.

Please login to leave a reply, or register at first.