I'm pulling the contents of an Excel spreadsheet into an ADO recordset and then displaying them on a web page. The problem I'm having is that Korean characters are not displaying.
I have set the codepage in the <@ %> at the top the page to '65001', I've set the charset to "utf-8", the spreadsheet is saved as utf-8 and so is my asp page.
I know it's not a problem with the server not having the Korean language pack installed, because Response.Write(objRS.Fields(x).Name) displays the Korean characters in the 1st row of my spreadsheet.
It's only Response.Write(objRS.Fields(x).Value) that displays '???' instead of the characters and I cannot, for my very life, figure out why.
Here's my code:
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
- </head>
- <body>
- <%
- Response.CodePage = 65001
- Response.CharSet = "utf-8"
- Dim objConn, objRS, strSQL
- Dim x
- Set objConn = Server.CreateObject("ADODB.Connection")
- objConn.Open "DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=YES; "&_
- "Excel 8.0; DBQ=" & Server.MapPath("import-test.xls") & "; "
- strSQL = "SELECT * FROM A1:E1000"
- Set objRS=objConn.Execute(strSQL)
- Response.Write("<table border=""1"">")
- Response.Write("<tr>")
- For x=0 To objRS.Fields.Count-1
- Response.Write("<th>" & objRS.Fields(x).Name & "</th>")
- Next
- Response.Write("</tr>")
- Do Until objRS.EOF
- Response.Write("<tr>")
- For x=0 To objRS.Fields.Count-1
- Response.Write("<td>" & objRS.Fields(x).Value & "</td>")
- Next
- Response.Write("</tr>")
- objRS.MoveNext
- Loop
- objRS.Close
- Response.Write("</table>")
- objConn.Close
- Set objRS=Nothing
- Set objConn=Nothing
- %>
- </body>
- </html>