本文介绍了阅读在MySQL /写Unicode数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的MySQL数据库,并希望能够读取和放大器;写的Unicode数据值。例如,法国/希腊/希伯来值。

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

我的客户端程序是C#(.NET框架3.5)。

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

如何配置我的数据库允许Unicode的? ?如何使用C#从MySQL读/写值作为unicode

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

OK,所以我的模式,表和安培;列被设置为'UTF8'+归类'utf8_general_ci'。我运行'设置名称UTF8时打开连接。到目前为止好......可是,还是值保存为'???????

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 '??????? '

什么想法?

OK,所以对于C#客户端读取和放大器;写Unicode值,则必须包括在连接字符串中:字符集= UTF8

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

例如:服务器= my_sql_server;用户ID = my_user;密码= MY_PASSWORD;数据库= some_db123;字符集= UTF8;

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

当然,你也应该定义相关的表作为UTF8 +整理utf8_bin。

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

推荐答案

解决方案!

确定,所以对于C#客户端阅读和放大器;写Unicode值,你必须包括在连接字符串中:字符集= UTF8

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

例如:服务器= my_sql_server;用户ID = my_user;密码= MY_PASSWORD;数据库= some_db123;字符集= UTF8;

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

当然,你也应该定义相关的表作为UTF8 +整理utf8_bin。

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

这篇关于阅读在MySQL /写Unicode数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 22:10