C#的Mysql UTF8编码 [英] C# Mysql UTF8 Encoding

查看:513
本文介绍了C#的Mysql UTF8编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有utf8_general_ci编码的mysql数据库,



我使用UTF-8页面和文件编码连接到与PHP相同的数据库并没有什么问题
但与C#连接MySQL的我有信这样غزة



我editit连接字符串是这样

 服务器=本地主机;密码=根;用户ID =根;坚持安全信息= TRUE;数据库= MyDatabase的;字符集= UTF8 

但同样的问题。


解决方案

 服务器= myServerAddress;数据库= MyDatabase的; UID =名为myUsername; PWD = MYPASSWORD;字符集= UTF8; 

请注意!使用小写值UTF8而不是大写UTF8,因为这将失败​​。



请参阅 HTTP ://www.connectionstrings.com/mysql


I have a mysql database with utf8_general_ci encoding ,

i'm connecting to the same database with php using utf-8 page and file encode and no problem but when connection mysql with C# i have letters like this غزة

i editit the connection string to be like this

server=localhost;password=root;User Id=root;Persist Security Info=True;database=mydatabase;Character Set=utf8

but the same problem .

解决方案

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; CharSet=utf8;

Note! Use lower case value utf8 and not upper case UTF8 as this will fail.

See http://www.connectionstrings.com/mysql

这篇关于C#的Mysql UTF8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆