I'm crazy about getting the content from mysql db and display it in vietnamese but always get strange code.
if (!IsPostBack)
{
string myConnectionString =
"Database=abc;Data Source=x.x.x.;User Id=abc;Password=abc;charset=utf8";
MySqlConnection myConnection = new MySqlConnection(myConnectionString);
MySqlCommand myCommand = new MySqlCommand(
"SELECT location_name FROM idv_province", myConnection);
MySqlDataAdapter myAdapter = new MySqlDataAdapter(myCommand);
DataSet myDataSet = new DataSet();
myAdapter.Fill(myDataSet, "idv_province");
foreach (DataRow row in myDataSet.Tables[0].Rows)
{
lblProvince.Text += row["location_name"].ToString() + "<br/>";
}
}
my page already has
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
it's been driving me crazy for a whole day. please help me, thanks alot.
Just adding the meta tag for UTF-8 does not necessarily "convert" your ASPX page to UTF-8.
You also have to save the ASPX file in Visual Studio as UTF-8. See File
> Advanced Save Options...
.
In addition, if you haven't read it, I would recommend reading Joel's introduction to Unicode .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.