I did it in PHP, using the iconv() function. I do batches, with the CP1252 (my original message was wrong) files named *.orig. I am doing this to build web pages, but I think it might serve your purpose with minor modifications.
Note that the PHP folks warned me that PHP is not really UTF-8 safe! So far, this appears to work; but you might want to use Perl instead. I don't even know if iconv() supports the character set you want. There's another possibility, by the way. I seem to recall that you have to make sure the character set used by the server, the client, and the connection are what you want (not to mention the data base, the table, and the fields). Look at this: mysql> show variables like "char%"; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | utf8 | | character_set_results | latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 7 rows in set (0.03 sec) In this case, the data base I'm using has a default character set of UTF-8. I forget if any of these are specific to the mysql command line client. You can change a bunch of them in one shot with the SET NAMES command in that client. Section 10.3.6 of the reference manual (I use the off line version for speed) discusses this. Multiple character sets give me a severe headache. <?php // This little script searches the current directory for *.orig, converts from the Windows // code page to UTF-8, and stuffs the results into the target for use in the web site foreach (glob("*.orig") as $file_to_convert) { $text_to_convert = file_get_contents($file_to_convert); $text_converted = iconv("cp1252","utf-8",$text_to_convert); file_put_contents(basename($file_to_convert,".orig"), $text_converted); } ?> Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 > -----Original Message----- > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Eric Lilja > Sent: Thursday, December 14, 2006 2:13 PM > To: mysql@lists.mysql.com > Subject: Re: MySQL 5.0.27: character problem > > Thanks for the reply, Mr Schwartz. I will see if I can find > some clue on > how to write such a program myself. > > - Eric > > Jerry Schwartz skrev: > > I have run into this as well. Windows uses CP-1522 (if I remember > > correctly), which is not exactly equivalent to UTF-8. I > presume it is also > > not exactly equivalent to the character set you're using > for MySQL. I wound > > up writing a program to convert the one character set to the other. > > > > Regards, > > > > Jerry Schwartz > > Global Information Incorporated > > 195 Farmington Ave. > > Farmington, CT 06032 > > > > 860.674.8796 / FAX: 860.674.8341 > > > > > >> -----Original Message----- > >> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Eric Lilja > >> Sent: Wednesday, December 13, 2006 2:03 PM > >> To: mysql@lists.mysql.com > >> Subject: MySQL 5.0.27: character problem > >> > >> Hello, I'm using MySQL version 5.0.27 under Windows XP > >> professional. I > >> have a text file with some SQL commands (I create a few tables and > >> insert some rows into them). I noticed that all columns where > >> I tried to > >> insert a swedish character, that character got corrupted. But > >> it works > >> if I type the same explicitly in mysql monitor. What do I > >> need to do so > >> I can use command files and still have proper handling of swedish > >> characters? > >> > >> - Eric > >> > >> > >> -- > >> MySQL General Mailing List > >> For list archives: http://lists.mysql.com/mysql > >> To unsubscribe: > >> http://lists.mysql.com/[EMAIL PROTECTED] > >> > >> > > > > > > > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]