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

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

问题描述

我有一个带有 utf8_general_ci 编码的 mysql 数据库,

I have a mysql database with utf8_general_ci encoding ,

我使用 utf-8 页面和文件编码使用 php 连接到同一个数据库,没问题但是当用 C# 连接 mysql 时,我有这样的字母 غزة

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

但同样的问题.

推荐答案

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

注意!使用小写值 utf8 而不是大写 UTF8,因为这会失败.

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

参见 http://www.connectionstrings.com/mysql

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

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