How to solve UTF8 With Bom when restore mysql database

Jun 23, 2014 at 3:39 AM
Hello everyone. When i restore mysql database from dumb file(.sql) . I always had UTF8 with Bom although i read file by utf8 format and i also have SET NAMES is utf8 as well!.
I don't know how to solve this problem and i need some help from you. Please help me out this problem!

This is my code.
 using(TextReader reader = File.OpenText(path_to_file))
                using (MySqlConnection conn = new MySqlConnection(ConnectionString))
                    using (MySqlCommand cmd = new MySqlCommand())
                        using (MySqlBackup mb = new MySqlBackup(cmd))
                            cmd.Connection = conn;
                            //mb.ImportInfo.DatabaseDefaultCharSet = "utf8";                        
I using latest version of Mysqlbackup

Thanks you very much!
Jun 23, 2014 at 4:19 AM
You wish the file to be encoded in UTF8 without BOM, but the output file is encoded with UTF8 with BOM?
You don't want the output file has the line of "SET NAMES" or
You don't want the "SET NAMES" is set to UTF8?

Is this your problem?
Jun 23, 2014 at 4:33 AM
Thanks for reply!

Sorry because i don't explain well! I already have database on phpmyadmin and i export that database to dumb file(.sql) using export button on phpmyadmin window.
Anh then i use that .sql file to restore other database on linux hosting in c# platform(console app). Of cource i am using mysqlbakup! This is heade inside my dumb file:
-- phpMyAdmin SQL Dump
-- version 4.0.8
-- Host: localhost
-- Generation Time: Mar 18, 2014 at 03:16 PM
-- Server version: 5.5.32-cll
-- PHP Version: 5.3.17

SET time_zone = "+00:00";

/*!40101 SET NAMES UTF-8 */;
Hope receive reply from you! Thanks.
Jun 23, 2014 at 5:00 AM
Sorry for not clear!

My dumb sql with utf8 without bom but when i restore it have utf8 with bom in database! I wanna restore database with utf8 in dumb sql file!

Thanks for take a look at this thread!
Sep 4, 2014 at 1:36 AM
Try to create a sample database that creates the error at:
give the connection string
then upload a sample C# project that creates the error at:
So I can test it directly.