简体   繁体   English

ASP CODEPAGE 65001和Mysql 5 utf-8

[英]ASP CODEPAGE 65001 and Mysql 5 utf-8

charset = UTF-8

CODEPAGE = 65001

MySql version: 5.0.92-enterprise-gpl-log

ADO.Version = 2.8

When I performe a search with unicode characters, like this: 当我使用Unicode字符执行搜索时,如下所示:

INSERT INTO table (utf8) VALUE ('♂')
SELECT utf8 FROM table WHERE utf8 = '♂' // \u2642

Where utf8 is VARCHAR collation utf8_unicode_ci 其中utf8是VARCHAR归类utf8_unicode_ci

MySql return 0 rows. MySql返回0行。

Removing CODEPAGE=65001 MySql return 1 row. 删除CODEPAGE=65001 MySql返回1行。 BUT Server.HTMLEncode now return weird symbols and utf8 characters now have length > 1. Not a big deal. BUT Server.HTMLEncode现在返回奇怪的符号,而utf8字符的长度>1。没什么大不了的。

edit: 编辑:

Ok, now I'm confused: this query works: 好的,现在我很困惑:此查询有效:

SELECT utf8 FROM table WHERE CONVERT(utf8 USING latin1) COLLATE latin1_general_ci = '♂'

obviously this is bad, it ignore INDEXs. 显然,这很不好,它会忽略INDEX。

Any help? 有什么帮助吗?

Do not include string literals in ASP script that have characters outside of the ASCII range. 在ASP脚本中不要包括字符超出ASCII范围的字符串文字。 The script engine parser doesn't do multi-byte character sets. 脚本引擎解析器不执行多字节字符集。 Use ChrW with the Unicode value for other characters. 将ChrW与其他字符的Unicode值一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM