[Go] FIX: Entity Framework + MariaDb (MYSQL) Chinese garbled

Source: Internet
Author: User

Transferred from: http://fenglongsheng.com/post/6640.html

Today write a mvc4+entity framework+mysql Small example, found that the Chinese write to the database is n a question mark (garbled oh ~);

I followed the code and found that the data submitted by the page was normal, which indicates that there was a problem with EF writing to the database.

In order to further verify, I tried with SQLServer2008, everything is normal, then find the reason on MySQL ~

But MySQL library code is also UTF8, the table is also UTF8, this is what reason?

Baidu has a, read a few articles also did not solve my problem, nothing but to the Web page, database, EF code to change the same, my original is consistent, is the field code? But how do you change the encoding of a field? Also did not find the method, suddenly see the field sort item is empty, could it be the reason? So change to utf8--test--everything normal ~ There is a picture of the truth:

[Go] FIX: Entity Framework + MariaDb (MYSQL) Chinese garbled

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.