473,770 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject("ADODB.Con nection")
conn.Open "DRIVER=Microso ft Excel Driver (*.xls);" & "DBQ=" & Server.MapPath( "uploadfold er/" & NewFileName)

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

'response.write connection
con.open connection
' Create recordset and retrieve values using the open connection
Set objRS = server.CreateOb ject("ADODB.Rec ordset")
<TABLE Border=1 CellPadding=3>
<TR class=TRAlterna te1>
<% For f = 0 To RS.Fields.Count-1%>
<TH>
<%= RS.Fields(f).va lue%></TH>

when i tried to display it using "RS.Fields(f).v alue", 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 6659
This _will_ work!

Success

<% @ codepage=65001 %>

<%
Dim a, r
Response.Write "<HTML><BOD Y>"
Response.CharSe t = "utf-8"
Set a = CreateObject("A DODB.Connection ")
a.Open "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Temp\ Book1.xls;Exten ded Properties=Exce l 8.0;Persist Security
Info=False"
Set r = a.Execute("SELE CT * 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*********@de ll.com> wrote in message
news:Or******** ********@TK2MSF TNGP12.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.CharSe t = "utf-8"

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

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

'response.write connection
con.open connection
' Create recordset and retrieve values using the open connection
Set objRS = server.CreateOb ject("ADODB.Rec ordset")
<TABLE Border=1 CellPadding=3>
<TR class=TRAlterna te1>
<% For f = 0 To RS.Fields.Count-1%>
<TH>
<%= RS.Fields(f).va lue%></TH>

when i tried to display it using "RS.Fields(f).v alue", 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><BOD Y>"
Response.CharSe t = "utf-8"
Set a = CreateObject("A DODB.Connection ")
a.Open "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Temp\ Book1.xls;Exten ded Properties=Exce l 8.0"
Set r = a.Execute("SELE CT * 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=Micro soft.Jet.OLEDB. 4.0;Data

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

a.Open "DRIVER=Microso ft 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*********@de ll.com> wrote in message
news:uJ******** ******@TK2MSFTN GP09.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=Micro soft.Jet.OLEDB. 4.0;Data

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

a.Open "DRIVER=Microso ft 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
3231
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 my code behind. when running the web form, the character which is entered directly to the web form during design time is displayed correctly, while those set from code behind appear as funny character
1
2706
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: ################################################## # import win32com.client xlapp = win32com.client.DispatchEx("Excel.Application") xlbook = xlapp.Workbooks.Open("test.xls") sht = xlbook.Worksheets("Sheet1")
2
2849
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 new text field, in one of my tables. Pasted some chinese text in the field(datasheet view), and the chinese text is sideways. The chinese character is flipped 90degrees. Ive tried different fonts, no difference. Ive typing in characters(not...
8
11983
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 part of a datagrid. When an input textbox is displayed it does not display chinese characters, but rather the unicode characters stored in the mssql 2000 server backend.
1
2874
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 mysql database, the chinese character will become "????". Alternatively, when i insert the chinese character from the program to the database, those chinese character will become symbols too.
0
1460
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 perfectly, but i am having problem when setting the label of my page to some chinese character during run-time which i do it from the code behind i realize the chinese will displayed correctly if i opened
7
4313
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 charactes, I have to use the following code to let it display on the web page: Public Function ToSCUnicode(ByVal str As String) As String Dim enc1252 As System.Text.Encoding = System.Text.Encoding.GetEncoding(1252) Dim arrByte_GBK As Byte() Dim...
6
7600
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 font of the chinese characters. I have tried setting the encoding in the database as UTF-8 and BIG5 but the characters display (both in MYSQL and when displayed via PHP) as question marks. Can anyone help?
1
2268
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 99% of the textboxes, entering chinese (or japanese or arabic) characters (using windows IME), in any amount and length, will show up and puts random characters int he textbox (sometimes '?', sometimes a box, sometimes a different chinese char,...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10259
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8933
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.