Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 14: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, 15: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, 15: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, 15: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, 15: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, 21: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

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