Solved

URGENT: Include 2 CharSet in 1 asp page

Posted on 2004-08-02
9
243 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
ID: 11700518
0
 
LVL 1

Author Comment

by:clarkyip
ID: 11700643
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
ID: 11700809
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:clarkyip
ID: 11700964
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
 
LVL 2

Assisted Solution

by:DejaVudew
DejaVudew earned 62 total points
ID: 11711005
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
ID: 11711713
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
ID: 11711801
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
ID: 12674678
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

762 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