Möglicherweise müssen Sie den Zeichensatz in cp1250 konvertieren, bevor Sie die Daten laden.
Ich habe das zuerst ausgeführt
mysql> show character set like 'cp%';
+---------+---------------------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------------------+-------------------+--------+
| cp850 | DOS West European | cp850_general_ci | 1 |
| cp1250 | Windows Central European | cp1250_general_ci | 1 |
| cp866 | DOS Russian | cp866_general_ci | 1 |
| cp852 | DOS Central European | cp852_general_ci | 1 |
| cp1251 | Windows Cyrillic | cp1251_general_ci | 1 |
| cp1256 | Windows Arabic | cp1256_general_ci | 1 |
| cp1257 | Windows Baltic | cp1257_general_ci | 1 |
| cp932 | SJIS for Windows Japanese | cp932_japanese_ci | 2 |
+---------+---------------------------+-------------------+--------+
8 rows in set (0.00 sec)
cp1252 existiert hier nicht. Der nächste ist cp1250.
Versuchen Sie diese Sequenz:
drop database if exists dtest;
create database dtest;
use dtest
set names cp1250;
CREATE TABLE `bar` (
`content` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
INSERT INTO bar VALUES (0x8081828384858687898A8B8C8D8E8F909192939495969798999A9B9C9D9E9F);
SELECT content FROM bar;
SHOW VARIABLES LIKE '%char%';
set names utf8;
SHOW VARIABLES LIKE '%char%';
ALTER TABLE bar CHANGE content content TEXT CHARACTER SET UTF8;
SELECT content FROM bar;
und sehen, was passiert.
Ich habe dies in MySQL 5.5.19 unter Linux bekommen
mysql> drop database if exists dtest;
Query OK, 0 rows affected (0.00 sec)
mysql> create database dtest;
Query OK, 1 row affected (0.00 sec)
mysql> use dtest
Database changed
mysql> set names cp1250;
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE TABLE `bar` (
-> `content` text
-> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
Query OK, 0 rows affected (0.01 sec)
mysql> INSERT INTO bar VALUES (0x8081828384858687898A8B8C8D8E8F909192939495969798999A9B9C9D9E9F);
Query OK, 1 row affected (0.00 sec)
mysql> SELECT content FROM bar;
+---------------------------------+
| content |
+---------------------------------+
| ??
?????? |
+---------------------------------+
1 row in set (0.00 sec)
mysql> SHOW VARIABLES LIKE '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | cp1250 |
| character_set_connection | cp1250 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | cp1250 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW VARIABLES LIKE '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql> ALTER TABLE bar CHANGE content content TEXT CHARACTER SET UTF8;
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> SELECT content FROM bar;
+---------------------------------------------------------------------------------+
| content |
+---------------------ŽÂÂâââââ---------------------------------------------------+
| â¬ÂâÆââ¦â â¡â°Å â¹Å ¢Å¡âºÅÂ
+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
und ich habe dies in MySQL 5.5.12 für Windows auf meinem Windows 7-Computer erhalten
mysql> drop database if exists dtest;
Query OK, 1 row affected (0.00 sec)
mysql> create database dtest;
Query OK, 1 row affected (0.02 sec)
mysql> use dtest
Database changed
mysql> set names cp1250;
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE TABLE `bar` (
-> `content` text
-> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
Query OK, 0 rows affected (0.06 sec)
mysql> INSERT INTO bar VALUES (0x8081828384858687898A8B8C8D8E8F909192939495969798999A9B9C9D9E9F);
Query OK, 1 row affected (0.00 sec)
mysql> SELECT content FROM bar;
+---------------------------------+
| content |
+---------------------------------+
| Ç?é?äàåçëèï??Ä??æÆôöòûù?ÖÜ¢??₧? |
+---------------------------------+
1 row in set (0.00 sec)
mysql> SHOW VARIABLES LIKE '%char%';
+--------------------------+---------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------+
| character_set_client | cp1250 |
| character_set_connection | cp1250 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | cp1250 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | C:\MySQL_5.5.12\share\charsets\ |
+--------------------------+---------------------------------+
8 rows in set (0.00 sec)
mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW VARIABLES LIKE '%char%';
+--------------------------+---------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | C:\MySQL_5.5.12\share\charsets\ |
+--------------------------+---------------------------------+
8 rows in set (0.00 sec)
mysql> ALTER TABLE bar CHANGE content content TEXT CHARACTER SET UTF8;
Query OK, 1 row affected (0.06 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> SELECT content FROM bar;
+---------------------------------------------------------------------------------+
| content |
+---------------------------------------------------------------------------------+
| €‚ƒ„…†‡‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ |
+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
Versuche es !!!