Solved

URGENT: Include 2 CharSet in 1 asp page

Posted on 2004-08-02
9
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
age from date of birth 4 63
One field not displaying content (ASP Classic) 8 42
VBScript on Html 15 64
removing a class in javascript 4 95
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

737 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