Solved

URGENT: Include 2 CharSet in 1 asp page

Posted on 2004-08-02
9
245 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
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 arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

729 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