Solved

URGENT: Include 2 CharSet in 1 asp page

Posted on 2004-08-02
9
240 Views
Last Modified: 2013-11-18
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.
0
Comment
Question by:clarkyip
9 Comments
 

Accepted Solution

by:
iwebfree earned 63 total points
Comment Utility
0
 
LVL 1

Author Comment

by:clarkyip
Comment Utility
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.
0
 
LVL 7

Expert Comment

by:j2nku
Comment Utility
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.
0
 
LVL 1

Author Comment

by:clarkyip
Comment Utility
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
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Assisted Solution

by:DejaVudew
DejaVudew earned 62 total points
Comment Utility
I don't believe that it would be possible to do this on the same page. Each page should only get a single charset. Response.Charset simply adds a header to the ASP file that tells the browser what charset the page is using. Same with using meta tags.

As j2knu pointed out, you can use framesets or inline frames.

Why do you need it to display in two charsets? Why not just use Unicode (maybe UTF-16)?
0
 
LVL 1

Author Comment

by:clarkyip
Comment Utility
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.
0
 

Expert Comment

by:iwebfree
Comment Utility
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.
0
 
LVL 6

Expert Comment

by:masirof
Comment Utility
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
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now