Link to home
Start Free TrialLog in
Avatar of clarkyip
clarkyip

asked on

URGENT: Include 2 CharSet in 1 asp page

Dear All,
    For some reason, my asp page need to display text in 2 charset. (One is UTF-8, one is Big5).
   The code is as follow but it fails.
*********************************************************************
<% @ CodePage = 950  Language = "VBScript"%>
<%
   Response.CharSet = "big5"
   dim rs
   dim dbConn
   strConnectString = "driver={SQL Server};server=xx.xx.xx.xx;uid=clarkyip;pwd=pw;database=clark"
   
   set dbConn=server.createobject("ADODB.connection")
      dbConn.open strConnectString  
   
   sql = "SELECT * FROM StaffName"
   set rs = dbConn.execute(sql)
   
  do while not rs.eof
   response.write rs("cNAME") &"<br>"
   rs.movenext
  loop

Response.write "<BR>"
  ' CodePage = 65001
   'Response.CharSet = "utf-8"
   Response.Write "Unicode: &#38515; &#22823; &#25991;"  
    %>    

    <HTML><HEAD><TITLE>aspupload</TITLE>
    </HEAD>
    <Body>
<BR>
    <HR>
*********************************************************************
I want the text load from database should be displayed in Big5, while the remaining text must be displayed in UTF-8. Please help in URGENT.
ASKER CERTIFIED SOLUTION
Avatar of iwebfree
iwebfree

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of clarkyip
clarkyip

ASKER

Hi, Thanks, the result I got will be only the UTF-8 text can be displayed is known now. However, any suggestion to let my page displaying 2 charset? Thanks again.
Don't know if it works, but make 2 different files - first one for displaying the DB with Response.Charset = "big5" and second one for displaying the remaining text with Response.Charset = "utf-8" and in the bottom of the file where you display the DB contents, write either
<!--// #include file="file2.asp" //-->
or
Server.Execute("file2.asp")
or
Server.Transfer("file2.asp")

I actually don't know do they act as 2 different files and i fear that browser takes these 2 as one whole content in big5 charset - only acceptable solution is in this case using frames, if it is acceptable.
Hi Thanks j2nku, I tried your suggestion to separate them into 2 files, but it still fails. Thanks again and waiting for any possible suggestion.
Clark
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually, it's the situation in one of my client. The site is hosted by themselves, so I cannot decided whether to use frame in their page or not.
They have this problem since in the same asp page, the first page then will load from db to display some text (UTF-8), and the lower part they will have some text by copy-and-paste work from other source, which they found that the pasted work is not in UTF-8, while in Big5 format, so they everytime need to paste the text directly into the db, or save as a unicode text file and re-copy-and-paste them.
Before I posted here, I also beleive that only one charset is allowed in a page, now I can very much sure for this, and will explain to them. Although the problem is a unsolvable problem, still very thanks for all of you to confirm my understanding.
Thanks.
if you read the article i posted earlier you will see it is not possible

See this:

http://www.asp-help.com/objects/intr7fw4.asyou would have to use frames or iframes.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Split: iwebfree & DejaVudew

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

masirof
EE Cleanup Volunteer