← Back to team overview

maria-discuss team mailing list archive

latin1 to utf8 conversion


I have a database(MariaDB 10.1.18) with latin1 characterset and a table with utf8 characterset.I can query the data only if i set names to latin1. How to convert the data to utf8 ?
I have tried export/import,iconv. But still data doesn't show up.

show create database test;+----------+----------------------------------------------------------------+| Database | Create Database                                                |+----------+----------------------------------------------------------------+| test      | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ |+----------+----------------------------------------------------------------+1 row in set (0.00 sec)
CREATE TABLE `Test` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL) ENGINE=InnoDB AUTO_INCREMENT=4312 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
set names utf8;Query OK, 0 rows affected (0.00 sec)
SELECT * FROM Test WHERE name = '2%Ss 60°C';Empty set (0.00 sec)
set names latin1;Query OK, 0 rows affected (0.00 sec)
SELECT name FROM Test WHERE name = '2%Ss 60°C';+------------+| name       |+------------+| 2%Ss 60°C|| 2%Ss 60°C|+------------+2 rows in set (0.01 sec)