0

There seems to be a lot of coverage of this on here, but I can't find anything that cracks the problem I'm having.

I have a MySQL Database which I am trying to do various nested queries with, which is new to me. I am using GROUP_CONCAT on the ID field to return a list of the ID values of the rows which are returned by the queries.

Using this on any other field returns a nice neat array of the data required, but on the ID field I am getting Gobbledegook! There is no collation set on this ID field, because the dB won't let me do so, the field is an auto-incrementing field with type set as int(10), so I guess this is why.

I asked my web hosts why I'm getting the gobbledegook, and the response was:

"When converting to a string ASP makes assumptions over the character set. The MySQL results are returned in UTF-8, not Windows-1521 as it assumes by default."

So, I started searching for this and came across this question on StackExchange; Classic ASP - How to convert a UTF-8 string to UCS-2?

I have tried running the function suggested in there, but it just turns the gobbledegook into question marks. The page returned is here: http://hartnollguitars.co.uk/test_search.asp?search=gibson%2008

I'm thinking that perhaps I am converting to or from the wrong character set with that function, but I'm afraid I don't know how to determine which I'm dealing with.

Anyway help to display these results would be appreciated.

The SQL Query is: (simplified)

results3.Open "SELECT * FROM (SELECT *, GROUP_CONCAT(id) as ItemList, count(id) as Variants FROM products WHERE item LIKE '%"& replace([searchterm]," ","%") &"%' GROUP BY item) AS UnknownVar LIMIT 40", conn, 3, &H0001

Example of outputs here: http://hartnollguitars.co.uk/test_search.asp?search=gibson%2008

Community
  • 1
  • 1
Jamie Hartnoll
  • 7,231
  • 13
  • 58
  • 97

1 Answers1

0

I'm taking another shot at this (previous answer removed). Please try to add the codepage directive to the page, and also set META charset to UTF-8, as below. The code below should send and tell browsers to interpret the page as UTF-8.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<% Response.Write... %>
</body>
</html>

Hope this helps!

Fredrik Johansson
  • 3,477
  • 23
  • 37