Deneb
Deneb

Reputation: 21

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:

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

Where utf8 is VARCHAR collation utf8_unicode_ci

MySql return 0 rows.

Removing CODEPAGE=65001 MySql return 1 row. BUT Server.HTMLEncode now return weird symbols and utf8 characters now have length > 1. Not a big deal.

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.

Any help?

Upvotes: 0

Views: 988

Answers (1)

AnthonyWJones
AnthonyWJones

Reputation: 189457

Do not include string literals in ASP script that have characters outside of the ASCII range. The script engine parser doesn't do multi-byte character sets. Use ChrW with the Unicode value for other characters.

Upvotes: 1

Related Questions