Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using MySql DB and want to be able to read & write unicode data values. For example, French/Greek/Hebrew values.

My client program is C# (.NET framework 3.5).

How do i configure my DB to allow unicode? and how do I use C# to read/write values as unicode from MySql?

Upddate: 7 Sep. 09

OK, So my Schema, Table & columns are set to 'utf8' + collation 'utf8_general_ci'. I run the 'set names utf8' when the connection is opened. so far so good... but, still values are saved as '??????? '

any ideas?

The Solution!

OK, so for C# client to read & write unicode values, you must include in the connection string: charset=utf8

for example: server=my_sql_server;user id=my_user;password=my_password;database=some_db123;charset=utf8;

of course you should also define the relevant table as utf8 + collation utf8_bin.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
135 views
Welcome To Ask or Share your Answers For Others

1 Answer

The Solution!

OK, so for C# client to read & write unicode values, you must include in the connection string: charset=utf8

for example: server=my_sql_server;user id=my_user;password=my_password;database=some_db123;charset=utf8;

of course you should also define the relevant table as utf8 + collation utf8_bin.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...