I have an ASP news page to which you can add comments. The comments open up in a new window, and users can click reply to reply to them after which they are taken to the parent page which has a comment form to fill in. The comments show fine, except when you click reply, and they contain either the " or the ' ie, apostrophe or double quotes, . what happens with the apostrophe is that instead of an '
it shows
ampersand, hash, 39 and semicolon. (I tried adding them here, but they turned into an apostrophe. so i had to edit this post and type in this sentence)
One of the include files that is the "inc.api.asp" has the code for all this i think, and i think it needs altering somewhere. I'm not sure if it's the parent page inc_api code that needs altering or the pop page which shows the comment.
Here is part of the inc_api.com page with the relevant code which may need fixing. Any suggestions welcome. Thanks in advance - <p>
-
<%
-
'// REPLACES INVALID CHARS FROM STRING TO BE PASSED INTO JavaScript
-
'// REPLACES THE FOLLOWING CHARS: "-'-(-) with `-`-[-`]
-
FUNCTION FIX_JS_STR(val)
-
Dim TMP_VAL
-
TMP_VAL = val
-
If Len(TMP_VAL) > 0 Then
-
TMP_VAL = Replace(TMP_VAL,chr(34),""")
-
TMP_VAL = Replace(TMP_VAL,"'","`")
-
TMP_VAL = Replace(TMP_VAL,"(","[")
-
TMP_VAL = Replace(TMP_VAL,")","]")
-
End IF
-
FIX_JS_STR = TMP_VAL
-
END FUNCTION
-
-
-
-
'// ENCRYPTS STRING SUCH AS PASSWORD
-
'// Returns encrypted string such as: BTEGE^J] to password
-
FUNCTION EnCrypt(strCryptThis)
-
Dim strChar, iKeyChar, iStringChar, i
-
for i = 1 to Len(strCryptThis)
-
iKeyChar = Asc(mid("2564218975223456482120840",i,1))
-
iStringChar = Asc(mid(strCryptThis,i,1))
-
iCryptChar = iKeyChar Xor iStringChar
-
strEncrypted = strEncrypted & Chr(iCryptChar)
-
next
-
EnCrypt = strEncrypted
-
END FUNCTION
-
-
'// DECRYPT STRING SUCH AS PASSWORD
-
'// Returns decrypted string such as: password to BTEGE^J]
-
FUNCTION DeCrypt(strEncrypted)
-
Dim strChar, iKeyChar, iStringChar, i
-
for i = 1 to Len(strEncrypted)
-
iKeyChar = (Asc(mid("2564218975223456482120840",i,1)))
-
iStringChar = Asc(mid(strEncrypted,i,1))
-
iDeCryptChar = iKeyChar Xor iStringChar
-
strDecrypted = strDecrypted & Chr(iDeCryptChar)
-
next
-
DeCrypt = strDecrypted
-
END FUNCTION
-
-
PRIVATE FUNCTION APO(val)
-
Dim tmpSTR
-
tmpSTR = val
-
IF NOT tmpSTR = "" THEN
-
tmpSTR = Replace(Trim(tmpSTR),chr(34),""")
-
tmpSTR = Replace(Trim(tmpSTR),"'","''")
-
tmpSTR = Replace(Trim(tmpSTR),"<","<")
-
tmpSTR = Replace(Trim(tmpSTR),">",">")
-
IF DB_TO_USE = 3 THEN tmpSTR = Replace(Trim(tmpSTR),"\","\\")
-
END IF
-
'APO = tmpSTR
-
APO = replace(val, "'", "'")
-
END FUNCTION
-
-
PRIVATE FUNCTION APO_LAX(val)
-
Dim strRES
-
strRES = Replace(Trim(val),"'","''")
-
IF DB_TO_USE = 3 THEN strRES = Replace(Trim(strRES),"\","\\")
-
'APO_LAX = strRES
-
APO_LAX = replace(val, "'", "'")
-
END FUNCTION
-
-
PRIVATE FUNCTION APO_INJ(val)
-
Dim tmpSTR
-
tmpSTR = val
-
IF NOT tmpSTR = "" THEN
-
tmpSTR = Replace(Trim(tmpSTR),chr(34),""")
-
tmpSTR = Replace(Trim(tmpSTR),"<","<")
-
tmpSTR = Replace(Trim(tmpSTR),">",">")
-
IF DB_TO_USE = 3 THEN tmpSTR = Replace(Trim(tmpSTR),"\","\\")
-
END IF
-
'APO_INJ = tmpSTR
-
APO_INJ = replace(val, "'", "'")
-
END FUNCTION
1 3409
I just want to add something,
in the 3 APO statements above there is a line in each which reads
APO_INJ = replace(val, "'", "'")
I just want to say that it doesn't show on this page, but the second apostrophe in the double quotes actually reads, "ampersand, hash, 39, semicolon"
I had to add this here because if you look at the code, it shows an apostrophe instead of the 4 characters . In the acctual inc_api.asp page, the first set shows an actual apostrope between the double quotes, and the second set shows "apersand, hash, 39 and semicolon"
I think this is a glitch in this forum,
Thanks.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Richard Hollenbeck |
last post by:
To prevent future apostrophe bugs and errors, isn't it just simpler to
forbid an apostrophe from being entered into a text field? For example,
couldn't "Alice's Restaurant" be changed to "Alices...
|
by: Jeff S |
last post by:
In a VB.NET code behind module, I build a string for a link that points to a
JavaScript function. The two lines of code below show what is relevant.
PopupLink = "javascript:PopUpWindow(" &...
|
by: AZNewsh |
last post by:
I am storing HTML in an oracle database, this is loaded from a textbox
in a webpage, I convert ' to ' ' using the code below:
foo.Replace("'", "''").Replace("&", "'||'&'||'")
this works just...
|
by: Alan Mailer |
last post by:
Ok, I've looked for an answer for this, because I'm sure it's been
asked a thousand times... but no luck... so here goes.
Imagine I want to create a NodeList based on an XPath statement. The...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| | |