0

I am trying to dump some data from mysql into an excel sheet . But the exported excel sheet contains some special accented characters(like ï¿½ï¿ Â) which is not present in the database .

My database is in "latin1" encoding and the centOS has "utf-8" code page . I tried to convert the field while selecting as below , but still few of the fields contain those accented characters . _

select convert(cat.name USING latin1)as category from category_table cat 
into outfile 'course_details.csv'
fields terminated by '|' lines terminated by '\n';

Also, converting it to utf8 also doesn't help . I have also tried double conversions .

Thanks for the help in advance !

3
  • It's unfortunate that you use CSV as a data transfer format. (Could you first create an Excel workbook and put the SQL in a Power Query query?) Anyway, CSV is a type of text file. All text files have a character encoding. The reader must use the same encoding as the writer. If you use Excel's Text Import (instead of Power Query), the wizard will ask you the encoding (or "origin"). How would you answer? If you are giving the CSV file to someone, tell them, too. Commented Apr 27, 2018 at 23:15
  • Do you have another example of the Mojibake characters? I have failed to reverse engineer ï¿½ï¿ Â. Commented Apr 28, 2018 at 0:54
  • @Tom : Thanks for the pointer , but we are working on restricted environment where no GUI is present and we just have centos prompt , so no external tools can be installed and neither we can connect it via external windows machine and use Power Query ; and hence the complications . Commented May 7, 2018 at 8:19

1 Answer 1

0

looks like conversion to latin 1 solved the problem . The other accented characters were already seeded into the db via some invalid means .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.