Database character encoding problems.

Discussion in 'MySQL' started by fatabbot, Feb 7, 2007.

  1. #1
    Hello

    I just noticed that my database uses latin1_swedish_ci character set. My html documents use UTF-8 unicode charset.
    Is there a way to convert every table in the database to UTF-8 unicode? Will anything happen to the data?
     
    fatabbot, Feb 7, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    If it's not broken don't fix it.
     
    krakjoe, Feb 9, 2007 IP
  3. ThomasNederman

    ThomasNederman Peon

    Messages:
    112
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you can dump the database and recreate it

    mysqldump -B database > Mydatabase.sql
    then in sql "drop database mydatabase"
    edit Mydatabase.sql and correct problem
    mysqladmin create database
    mysql database <Mydatabase.sql
     
    ThomasNederman, Feb 9, 2007 IP
  4. bochgoch

    bochgoch Peon

    Messages:
    1,918
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can use this to convert tables to utf8 - you'll need MySQL version 4.1+

    ALTER TABLE x CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
     
    bochgoch, Feb 9, 2007 IP
  5. fatabbot

    fatabbot Well-Known Member

    Messages:
    559
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    138
    #5
    That worked, Thanks.
    Although some characters like é, è the copyright symbol, the TM symbol still show up on the webpage as weird black dots with a question mark in it ...
     
    fatabbot, Feb 10, 2007 IP