SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast O_o.moo's Avatar
    Join Date
    Aug 2007
    Location
    South Africa
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL db backup with special characters

    Hi,

    Anyone have a simple solution for importing a *.sql file so that the special characters appear correctly.

    Any other solutions welcome.

    THANKS
    My Temporary Résumé!
    watch this space

  2. #2
    secure webapps for all Aleksejs's Avatar
    Join Date
    Apr 2008
    Location
    Riga, Latvia
    Posts
    755
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure that file is encoded in UTF8 without BOM.
    add these two lines as first lines before all other statements:
    SET NAMES utf8;
    SET CHARACTER SET utf8;

  3. #3
    SitePoint Enthusiast O_o.moo's Avatar
    Join Date
    Aug 2007
    Location
    South Africa
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will this matter at all, it's from Client API version 5.0.27 to Client API version 5.0.32
    My Temporary Résumé!
    watch this space

  4. #4
    secure webapps for all Aleksejs's Avatar
    Join Date
    Apr 2008
    Location
    Riga, Latvia
    Posts
    755
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do not think, it will matter. However you should check if my assumption about UTF8 is correct - maybe your data is in different encoding (and tables???).
    What does:
    SHOW CREATE TABLE your_table_name;
    display in your database?
    More on encodings:
    http://dev.mysql.com/doc/refman/5.1/...set-mysql.html

  5. #5
    SitePoint Enthusiast O_o.moo's Avatar
    Join Date
    Aug 2007
    Location
    South Africa
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CREATE TABLE `bla_blsa` (
    `bla_id` int(11) NOT NULL auto_increment,
    `bla_bla_bla` varchar(255) default NULL,
    PRIMARY KEY (`bla_id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
    My Temporary Résumé!
    watch this space

  6. #6
    secure webapps for all Aleksejs's Avatar
    Join Date
    Apr 2008
    Location
    Riga, Latvia
    Posts
    755
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok - then you just add those two lines I posted before and you should be all right


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •