Superscript (TM) in SQL string using ASP?

M

MBS

I am trying to pass a string from one page to another. The input
string comes from a database and many times has the superscript TM
trademark symbol. The querystring handles this properly because it
appears correctly in the next pages URL. However, when I do a
response.write of the querystring, the symbol has been changed to
"ProductT" for example so I can't assign this to an SQL string. Of
course, the database dosen't return this. How can I get around this?

Thanks
Bailey--
 
B

Bob Barrows

MBS said:
I am trying to pass a string from one page to another. The input
string comes from a database and many times has the superscript TM
trademark symbol. The querystring handles this properly because it
appears correctly in the next pages URL. However, when I do a
response.write of the querystring, the symbol has been changed to
"ProductT" for example so I can't assign this to an SQL string. Of
course, the database dosen't return this. How can I get around this?

Thanks
Bailey--

Depending on where you are writing it to, you may need to use the HTMLEncode
function to handle the non-standard characters.

HTH,
Bob Barrows
 
M

MBS

Can you elaborate further on how to implement this function in this
context? The string (containing the superscript) will be used in an
SQL "where" clause to re-query the database. I looked up the function
but I guess I am not knowledgeable enough to understand how it relates
to this. I also did a search on google to see how superscript and
other non-standard characters are handled in sql strings using ado and
surprisingly can't find anything.

Thanks.
 
B

Bob Barrows

MBS said:
Can you elaborate further on how to implement this function in this
context? The string (containing the superscript) will be used in an
SQL "where" clause to re-query the database. I looked up the function
but I guess I am not knowledgeable enough to understand how it relates
to this. I also did a search on google to see how superscript and
other non-standard characters are handled in sql strings using ado and
surprisingly can't find anything.

Thanks.

Without seeing your code, the only thing I can say is:

response.write htmlencode(<whatever>))

Bob Barrows
 
M

MBS

Okay, here is some of the relevant code.

Here is the needed string with the "TM" getting past from the first
page:
Meniett™ Ménière's Disease Therapy Device

LinkText = Replace(Request.QueryString("LinkText"), "'", "''")
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_Conn_Xom_STRING
SQL ="SELECT distinct category, subcat FROM GroupInfo Where Category
='"&LinkText&"'" & "ORDER BY subcat"
Recordset1.Source = SQL

response.write server.htmlencode(SQL)
'= MeniettT Ménière''s Disease Therapy Device
'This is the same output as when not using the htmlencode! What am I
missing?

Recordset1.Source = SQL
 
M

MBS

Another thing that I am noticing is that whenever the querystring
contains the registered trademark symbol "®" that if I do a
response.write of the string, the symbol appears correctly but is
flaky when going against the access db. For example sometimes the
recordset is empty when in fact, it is not. However, if I cut and
paste this (below) and run it inside access, there are records! It is
as though some special characters are getting dropped from the asp
page to the database. What's up with this?

Here is a sample:
SELECT * from products where prodname=activent®
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top