mysql字符集与asp,ASP,MySQL和UTF-8

First of all, I've read almost all topics about this. I've tried all advices but I couldn't solve this problem.

Here is the thing. I use Classic ASP and MySQL for a project. Everything just fine. If I write (an example) Response.Write("ĞŞÜÇÖİ") it works like a charm. But if that string comes from database, I see "ÄÅÜÇÖİ" instead of "ĞŞÜÇÖİ". When I look this with phpMyAdmin it's ok.

I use Dreamweaver CS6. I save all pages Unicode (UTF-8). I've written Session.CodePage = 65001, Response.CodePage = 65001, Response.Charset = "utf-8" in an include file that every page has it at the top. I've written meta charset utf-8. I use ODBC 5.2 x64 driver and my connection string has charset:UTF8;. And all MySQL settings utf-8 (tables, fields, everything).

Well I don't want to use other encodings, charsets. What am I doing doing wrong? It seems, it's about database. What is the problem?

解决方案

You need to specify the character set in the connection string using the charset parameter; see the MySQL ODBC doco. e.g. add "charset=utf8;" "charset=ucs2;" to your connection string.

Edited: I finally got a chance to run a simple test harness on this, and it does indeed fail with charset=utf8. However, since VBScript is running internally with UCS2, I gave it a try with charset=ucs2 and it works fine. NB: page is still set to send all output as UTF-8, it's just that VBScript is pulling data from an ODBC connection using UCS2. Job is done :)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值