Search code examples
mysqlcsvmysqlimport

mysqlimport cannot read trademark symbol


I have a large CSV data file. One of the fields in the file contains ™ symbol. I have created the table using

CREATE TABLE scraped_data(
.....) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Then I have imported the data into the DB using mysqlimport command.

mysqlimport --ignore-lines=1 --fields-terminated-by=',' --fields-enclosed-by='"' --local -u root -p scraping scraped_data.csv

then, after processing I have exported the file back to csv. But the exported file contains â„¢ symbol instead of ™. How do I retain this symbol in the exported csv ?


Solution

  • I have changed the charset to utf8 by creating table by using

    CREATE TABLE scaped_data( 
    ....)ENGINE=MyISAM DEFAULT CHARSET=utf8;
    

    This solved the problem.