473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Read Chinese character from excel using asp

I use asp to develop a web page to read an excel file containing Chinese Character then display it in the web page. Unfortunately, I cant display it!!! it will display (?????????).

<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
' create and open the connection to the Excel file
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DRIVER=Microsoft Excel Driver (*.xls);" & "DBQ=" & Server.MapPath("uploadfolder/" & NewFileName)

Set RS = conn.Execute("Select * From [Customer_Group]")

'response.write connection
con.open connection
' Create recordset and retrieve values using the open connection
Set objRS = server.CreateObject("ADODB.Recordset")
<TABLE Border=1 CellPadding=3>
<TR class=TRAlternate1>
<% For f = 0 To RS.Fields.Count-1%>
<TH>
<%= RS.Fields(f).value%></TH>

when i tried to display it using "RS.Fields(f).value", i only can c ???? so, I think the problem is i cant even get/read the chinese character from the excel file. Pls help me.
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Jul 19 '05 #1
4 6611
This _will_ work!

Success

<% @ codepage=65001 %>

<%
Dim a, r
Response.Write "<HTML><BODY>"
Response.CharSet = "utf-8"
Set a = CreateObject("ADODB.Connection")
a.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Temp\Book1.xls;Extended Properties=Excel 8.0;Persist Security
Info=False"
Set r = a.Execute("SELECT * FROM [Sheet1$]")
Do Until r.EOF
Response.Write r.Collect(0)
Response.Write "<BR>"
r.MoveNext
Loop
a.Close
Response.Write "</BODY></HTML>"
%>
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm
"Lee See Mun" <se*********@dell.com> wrote in message
news:Or****************@TK2MSFTNGP12.phx.gbl...
I use asp to develop a web page to read an excel file containing Chinese
Character then display it in the web page. Unfortunately, I cant display
it!!! it will display (?????????).

<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
Hi,

meta tags are for backward-compat and for non-dynamic pages.

Response.CharSet = "utf-8"

' create and open the connection to the Excel file
Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.Oledb.4.0;extensions=Micro soft Excel
Driver (*.xls);" & "DBQ=" & Server.MapPath("uploadfolder/" & NewFileName)

Set RS = conn.Execute("Select * From [Customer_Group]")

'response.write connection
con.open connection
' Create recordset and retrieve values using the open connection
Set objRS = server.CreateObject("ADODB.Recordset")
<TABLE Border=1 CellPadding=3>
<TR class=TRAlternate1>
<% For f = 0 To RS.Fields.Count-1%>
<TH>
<%= RS.Fields(f).value%></TH>

when i tried to display it using "RS.Fields(f).value", i only can c ????
so, I think the problem is i cant even get/read the chinese character from
the excel file. Pls help me.
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...


Jul 19 '05 #2
tiny improvement

<% @ codepage=65001 %>

<%
Dim a, r, f
Response.Write "<HTML><BODY>"
Response.CharSet = "utf-8"
Set a = CreateObject("ADODB.Connection")
a.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Temp\Book1.xls;Extended Properties=Excel 8.0"
Set r = a.Execute("SELECT * FROM [Sheet1$]")
Set f = r(0)
Do Until r.EOF
Response.Write f
Response.Write "<BR>"
r.MoveNext
Loop
r.Close
a.Close
Response.Write "</BODY></HTML>"
%>

Jul 19 '05 #3
Hi Egbert Nierop,

I still face some problem with the code. I copied all the code provided by u n i change the excel file path to point to my excel file. The rest of the codes r still the same. I got this error:

Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/test2.asp, line 8, column 45
a.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data

It seems that i cant use this provider! i try to use another provider

a.Open "DRIVER=Microsoft Excel Driver (*.xls);DBQ=C:\EWS List CCC3.xls"

but i get this error:
Error Type:
(0x8007007F)
/test2.asp, line 15

Please help me. It has been days and i still could find the solution. Thank you.
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Jul 19 '05 #4
Hi,

It means that your server does not have the necessary versions.
You -need- oledb 3.51 at least, to have unicode support. About UTF-8 which
is a modern unicode encoding, I really advice to you to use Oledb 4.0
The solution should be simple. Install the JET provider/drivers for your
Specific OS.
http://www.microsoft.com/downloads/r...DisplayLang=en

And also, better use my code which utilizes oledb and not odbc.

--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

"Lee See Mun" <se*********@dell.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Hi Egbert Nierop,

I still face some problem with the code. I copied all the code provided by
u n i change the excel file path to point to my excel file. The rest of
the codes r still the same. I got this error:

Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/test2.asp, line 8, column 45
a.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data

It seems that i cant use this provider! i try to use another provider

a.Open "DRIVER=Microsoft Excel Driver (*.xls);DBQ=C:\EWS List CCC3.xls"

but i get this error:
Error Type:
(0x8007007F)
/test2.asp, line 15

Please help me. It has been days and i still could find the solution.
Thank you.
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...


Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Coco | last post by:
Hi! I managed to display chinese character in my web form (.aspx), in certain situation i need to to set the text of the label of my web form in chinese character programatically which is done in...
1
by: zxo102 | last post by:
Hi there, I am trying to put data including Chinese Characters into Excel through python. But I got some problems. Here is my sample code: ################################################## #...
2
by: bob | last post by:
Im having a wierd chinese font issue in Access 2000. I installed the chinese support for access 2000, have all the windows stuff setup, even have 10-12 other chinese fonts installed. I made a...
8
by: pabv | last post by:
Hello all, I am having a few issues with encoding to chinese characters and perhaps someone might be able to assist. At the moment I am only able to see chinese characters when displayed as...
1
by: CYF | last post by:
My Computer : Window XP Pro English Version -> I have set the "Regional" to "Taiwan" Mysql 4.1.x -- > set to big5 already i am using C# to program. When i retrieve chinese character from the...
0
by: Coco | last post by:
Hi! I have been searching for solution for the problem i am facing in displaying chinese character in my aspx page initially when i created the aspx page with some chinese chaarcter, it worked...
7
by: c.verma | last post by:
I have a web application. There is a page which has a datagrid on it.The datagrid displays the data that comes from SAP. SAP sends the chinese characters to this grid. Before I display CHinese...
6
by: Steve | last post by:
Hi. I need to store chinese characters and Pinyins in a mysql database and then read them from php and using the GD library and imagettftext() function to create an image based on a chinese ttf...
1
by: greggorob64 | last post by:
Hello, I am working with a system developed several years ago, and was recently internationalized to support unicode languages. I am running into a very frustrating and challenging problem: In...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.