468,510 Members | 1,753 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,510 developers. It's quick & easy.

Display Korean characters from an excel spreadsheet via an ADO Recordset

Hello,

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
  1. <html>
  2. <head>
  3. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  4. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  5. </head>
  6. <body>
  7.  
  8. <%
  9.  
  10. Response.CodePage = 65001
  11. Response.CharSet = "utf-8"
  12.  
  13. Dim objConn, objRS, strSQL
  14. Dim x
  15.  
  16. Set objConn = Server.CreateObject("ADODB.Connection")
  17. objConn.Open "DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=YES; "&_
  18.     "Excel 8.0; DBQ=" & Server.MapPath("import-test.xls") & "; "
  19.  
  20. strSQL = "SELECT * FROM A1:E1000"
  21. Set objRS=objConn.Execute(strSQL)
  22. Response.Write("<table border=""1"">")
  23. Response.Write("<tr>")
  24. For x=0 To objRS.Fields.Count-1
  25.           Response.Write("<th>" & objRS.Fields(x).Name & "</th>")
  26. Next
  27. Response.Write("</tr>")
  28. Do Until objRS.EOF
  29.     Response.Write("<tr>")
  30.     For x=0 To objRS.Fields.Count-1
  31.             Response.Write("<td>" & objRS.Fields(x).Value & "</td>")
  32.     Next
  33.     Response.Write("</tr>")
  34.     objRS.MoveNext
  35. Loop
  36. objRS.Close
  37. Response.Write("</table>")
  38. objConn.Close
  39. Set objRS=Nothing
  40. Set objConn=Nothing
  41. %>
  42. </body>
  43. </html>
If anyone could please, please tell me how to solve this weird problem, I would be forever grateful, I'm tearing my hair out here!
Sep 7 '12 #1
1 2553
zmbd
5,400 Expert Mod 4TB
Poke in the dark...
Sorry, not much direct help for you here as this is a tad out of my depth. What I can offer is some critical thinking skills for troubleshooting....

Hopefully, nothing too silly - I'm not really sure where your problem is so, just a few questions:

You can see the Korean charactors in the workbooks?

When you open the ADO database directly, can you see them in the tables?

And my sillest question of the day: Have you tried to open the test page on a computer that you know for sure is able to display the Korean charactor set?

-z
Are you sure the cat didn't un-plug the tele?
I understand, but you know how cats like to play... just a quick peak and poke if you would........
Oh, That's OK, Glad it was an easy fix.
Sep 10 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Jim, N2VX | last post: by
5 posts views Thread by Tim Marsden | last post: by
5 posts views Thread by barbara_dave | last post: by
3 posts views Thread by D.Stone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.