Forum Moderators: coopster

Message Too Old, No Replies

PhpMyAdmin - problem with charset

moving data from server1 to server2

         

ppenza

5:25 pm on Jul 16, 2005 (gmt 0)

10+ Year Member



Hello

I have problem with charset in my Mysql database.

server 1(localhost):
Mysql version 5 with php5
MySQL charset is UTF-8 Unicode (utf8)
MySQL connection collation - latin2_general_ci

server 2:
Mysql version 4.1.8 php 4.3.10
MySQL charset is UTF-8 Unicode (utf8)
MySQL connection collation - latin2_general_ci

As you can see both servers have same charset configuration, so here can't be any problems.

When i'm trying to dump data from one of the table from my db ( server 2 -> server1) in result mysql gives me strange symbol. For example "£(from polish alphabet) replaced by?".

I'm from Poland so i'm trying to use ISO-8859-2 charset style.

In my PhpMyAdmin configuration file i have:


/* From config.default.php */
$cfg['DefaultCharset'] = 'iso-8859-2';

My apache 2.0 get on well with words like £,¹,¿,Ÿ...

If you can give me some advice(s) please reply for this post.

Best regards
Peter

Anyango

7:14 pm on Jul 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Might appear bad suggestion but

have you tried to do vice versa operation?

tried to copy tables from server2> server1 , if server1> server2 is giving error..

That might yeild something.

ergophobe

7:58 pm on Jul 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This would work okay with ISO-8859-1 and UTF-8 because UTF-8 is a superset of ISO-8859-1. In other words, any characters that are part of the ISO-8859-1 charset can be transferred from UTF-8 to ISO-8859-1 without conversion. Same bits.

For any other charset, this will only be true for those characters that are the same as ISO-8859-1. Otherwise, to go from UTF-8 to ISO-8859-* you need to do some sort of conversion. Better yet, try using UTF-8 from start to finish.

ppenza

8:08 pm on Jul 16, 2005 (gmt 0)

10+ Year Member



hello
Thanks for answer me.

I wants to import data (over 1000 records) from server2 to my localhost mysql db(witch is empty, so i can't import vice-versa).

But while i was trying to do (server2 -> server1) i observed that mysql in server1 changed one of my MySQL connection collation - latin2_general_ci to latin1_swedish_ci. I have no idea why. As i already said my server2 have also MySQL connection collation - latin2_general_ci.


CREATE TABLE `kid_prod` (
`id_prod` int(11) NOT NULL auto_increment,
`id_head` int(11) NOT NULL default '0',
`id_s_kat` int(11) NOT NULL default '0',
`id_parent` int(11) NOT NULL default '0',
`title_prod` text NOT NULL,
`desc_prod` text NOT NULL,
`popular_prod` int(11) NOT NULL default '0',
`status_prod` int(11) NOT NULL default '0',
PRIMARY KEY (`id_prod`),
FULLTEXT KEY `title_prod` (`title_prod`),
FULLTEXT KEY `desc_prod` (`desc_prod`)

) TYPE=MyISAM AUTO_INCREMENT=684 ;

Maybe i need to put somethings after "TYPE=MyISAM AUTO_INCREMENT=684 "..?

Best regards
Peter

ergophobe

8:20 pm on Jul 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



BTW - Welcome to WebmasterWorld Peter. I didn't notice you were new at first.

You would specify a charset for a table like this

CREATE TABLE `table1` (
#stuff
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

(obviously changing latin1 to whatever you need).

I had some strange issue with that when changing MySQL versions - tables carried over default charsets that didn't match the desired charset and it created some problems.

ppenza

8:29 pm on Jul 16, 2005 (gmt 0)

10+ Year Member



thanks for greeting and direction:) i will try your advice, and i will inform you about progress.

Best regards
Peter

ppenza

6:14 pm on Jul 17, 2005 (gmt 0)

10+ Year Member



hello again:)


CREATE TABLE `table1` (
#stuff
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

and no more strange symbols:) thanks alot for advice!

Best regards
Peter

ergophobe

7:12 pm on Jul 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm glad it's sorted.

It's sort of annoying, but I suppose I might want table-level control of that sort of thing, but thus far it's mostly been an inconvenience for me as it was for you!

ppenza

9:45 pm on Jul 17, 2005 (gmt 0)

10+ Year Member



Hello:)

According to my unbound problem. I want to add, that i have to put this code at the beginning in my all files


mysql_query("set names latin2;");

not like this:


mysql_query("set names utf-8;");

becouse second option doesn't work:)

Maybe it will be useful for somebody:)

Best regards
Peter