If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > backup doesn't preserve foriegn characters

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-06-07, 13:01
daffy_dowden daffy_dowden is offline
Registered User
 
Join Date: Jan 2004
Location: Northumberland, England
Posts: 11
Red face backup doesn't preserve foriegn characters

I'm backing up a database I'm working on that contains a lot of text in French, and i've noticed that within the sql backup files, all of the French characters have been replaced by strange symbols, such as copyright logos and the like.

How can I stop it from garbling this data?

I have the Collation set to latin1_general_cs in the character set for the table. Is there something else that I need to perform?

Thanks,
Daf
Reply With Quote
  #2 (permalink)  
Old 11-06-07, 14:25
ortho ortho is offline
Registered User
 
Join Date: Nov 2006
Location: Quebec
Posts: 172
You see that when you restore, or in the backup it-self?
__________________
Less is more.
How long is now?
http://www.lesouterrain.com
Reply With Quote
  #3 (permalink)  
Old 11-06-07, 14:31
ortho ortho is offline
Registered User
 
Join Date: Nov 2006
Location: Quebec
Posts: 172
Maybe you can perform this command to make your backup:

mysqldump -Q --add-drop-table --default-character-set=utf8 --compatible=mysql40 --set-charset=utf8 DATABASENAME > BACKUP.SQL

where DATABASENAME is the name of your database and BACKUP.SQL is the name of the sql dump file.

Note that some parameters are optional like "--add-drop-table".
__________________
Less is more.
How long is now?
http://www.lesouterrain.com
Reply With Quote
  #4 (permalink)  
Old 11-06-07, 14:46
daffy_dowden daffy_dowden is offline
Registered User
 
Join Date: Jan 2004
Location: Northumberland, England
Posts: 11
Hi Ortho,
Just before I try your code suggestion I just wanted to say that I see it in the sql backup, but when I re-import this code the affected characters are imported incorrectly too.
Reply With Quote
  #5 (permalink)  
Old 11-06-07, 14:52
daffy_dowden daffy_dowden is offline
Registered User
 
Join Date: Jan 2004
Location: Northumberland, England
Posts: 11
just tried the command, and I'm still getting the weird characters. When I ran the command it said that the --set-charset had an invalid value for utf8 though.
Reply With Quote
  #6 (permalink)  
Old 11-06-07, 20:35
thrash.zhai thrash.zhai is offline
Registered User
 
Join Date: Oct 2007
Posts: 3
may be you should try this command:
mysqldump -uusername -ppassword --default-character-set=latin1 databasename > backup.sql

i think the parameter(--default-character-set) is the same as your database charset.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On