SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict MrBaseball34's Avatar
    Join Date
    Sep 2002
    Location
    Round Rock, Texas
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't get Unicode data imported correctly

    I have a CSV file encoded Unicode UTF-8.
    Here is my table schema:
    Code:
    CREATE TABLE `country_states` (
        `country_name` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
        `country_iso_char_2_code` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
        `state_code` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
        `state_name` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci'
    )
    CHARSET=UTF8
    COLLATE='utf8_unicode_ci'
    ENGINE=MyISAM
    ROW_FORMAT=DEFAULT
    This imports all the data but it is not showing Unicode in the data.
    Code:
    LOAD DATA LOCAL INFILE '/downloads/cdh_download.csv' 
    INTO TABLE country_states 
    FIELDS TERMINATED BY ',' 
    OPTIONALLY 
    ENCLOSED BY '"' LINES 
    TERMINATED BY '\r\n' 
    IGNORE 1 LINES;
    What am I doing wrong?
    MrBaseball34
    Hook'Em Horns!

  2. #2
    SitePoint Addict MrBaseball34's Avatar
    Join Date
    Sep 2002
    Location
    Round Rock, Texas
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forgot to SET NAMES before creating the table. DUH!!!
    MrBaseball34
    Hook'Em Horns!


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
  •