Archive for August, 2008

ASP.NET with MySqlConnector 로 데이터를 utf-8로 넣을때 ???? 경우

오랜만에 로깅

.NET에서 MySql Connector로 데이터를 넣는데 자꾸 utf-8이 ????로만 들어가는 문제가 발생

쿼리 앞에다가 set names utf8을 넣기도, DB의 기본 캐릭터셋도 전부 utf8로 설정했는데도 마찬가지로 ????가 발생.

다른 이유도 있을 수 있겠지만, 해결방법은 ConnectionString에다가 아래와 같이 charset=utf8을 넣어주면 된다.

string strCon = “Database=db;Data Source=localhost;User Id=db;Password=password;charset=utf8”; string defSql = “set names utf8”; myCon = new MySqlConnection(strCon); myCon.Open(); Tags:

Comments