You have a chance for Slovenian letters according to this mapping and excerpt from the Windows-1252 wiki article :
According to Microsoft and Unicode Consortium websites, items 81, 8D, 8F, 90, and 9D are not used; however, the Windows MultiByteToWideChar API maps them to the corresponding C1 control codes .
The euro symbol at position 80 was absent in earlier versions of this code page, as well as S, s, Z and z with karon (hΓ‘Δek).
Here's what you need to do:
Use UTF-8 encoded files (without specification) versus being able to contain hard-coded text. (β already done)
Specify UTF-8 for the response character set with ASP on the server side or with meta tags on the client side. (β already done)
Tell the MySQL server that your commands are in utf-8 encoding, and you expect utf-8 encoded datasets. Add the original statement to the connection string: ...;stmt=SET NAMES 'utf8';...
Set Response.CodePage to 1252.
I tested the following script and it works like a charm.
DDL: http://sqlfiddle.com/#!8/c2c35/1
ASP:
<%@Language=VBScript%> <% Option Explicit Response.CodePage = 1252 Response.LCID = 1060 Response.Charset = "utf-8" Const adCmdText = 1, adVarChar = 200, adParamInput = 1, adLockOptimistic = 3 Dim Connection Set Connection = Server.CreateObject("Adodb.Connection") Connection.Open "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDb;User=myUsr;Password=myPwd;stmt=SET NAMES 'utf8';" If Request.Form("name").Count = 1 And Len(Request.Form("name")) Then 'add new Dim rsAdd Set rsAdd = Server.CreateObject("Adodb.Recordset") rsAdd.Open "names", Connection, ,adLockOptimistic rsAdd.AddNew rsAdd("name").Value = Left(Request.Form("name"), 255) rsAdd.Update rsAdd.Close Set rsAdd = Nothing End If Dim Command Set Command = Server.CreateObject("Adodb.Command") Command.CommandType = adCmdText Command.CommandText = "Select name From `names` Order By id Desc" If Request.QueryString("name").Count = 1 And Len(Request.QueryString("name")) Then Command.CommandText = "Select name From `names` Where name = ? Order By id Desc" Command.Parameters.Append Command.CreateParameter(, adVarChar, adParamInput, 255, Left(Request.QueryString("name"), 255)) End If Set Command.ActiveConnection = Connection With Command.Execute While Not .Eof Response.Write "<a href=""?name=" & .Fields("name").Value & """>" & .Fields("name").Value & "</a><br />" .MoveNext Wend .Close End With Set Command.ActiveConnection = Nothing Set Command = Nothing Connection.Close %><hr /> <a href="?">SHOW ALL</a><hr /> <form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>"> Name : <input type="text" name="name" maxlength="255" /> <input type="submit" value="Add" /> </form>
As a final note:
If you need to apply html encoding to strings retrieved from the database, you should no longer use Server.HTMLEncode due to Response.Codepage - 1252 on the server side, and since Server.HTMLEncode is a dependent contextual code page, this will cause gibberish exits.
Therefore, you need to write your own html encoder to handle this case.
Function MyOwnHTMLEncode(ByVal str) str = Replace(str, "&", "&") str = Replace(str, "<", "<") str = Replace(str, ">", ">") str = Replace(str, """", """) MyOwnHTMLEncode = str End Function 'Response.Write MyOwnHTMLEncode(rs("myfield").value)