Andrew
asked on
ASP character encoding?
Hello, can someone explain to me why and how to keep one of my .asp pages from passing
this character é as this é from one .asp page to the next and also into my SQL DB via a SQL Insert Query?
IE9: é = é
Chrome18: é = é
FireFox9: é = é
asp1.asp=
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- #include file="ASPConnection.inc" -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
</head>
<form id="DonateForm" name="DonateForm" action="GCP21Reg2.asp" class="formular" method="post">
Name*</label><input id="txtFName" class="validate[required] text-input" name="txtFName" size="35" type="text" value="" />
</form>
asp2.asp=
sFirstName = Request("txtFName")
response.write sFirstName
TIA,
Andrew
this character é as this é from one .asp page to the next and also into my SQL DB via a SQL Insert Query?
IE9: é = é
Chrome18: é = é
FireFox9: é = é
asp1.asp=
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- #include file="ASPConnection.inc" -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
</head>
<form id="DonateForm" name="DonateForm" action="GCP21Reg2.asp" class="formular" method="post">
Name*</label><input id="txtFName" class="validate[required] text-input" name="txtFName" size="35" type="text" value="" />
</form>
asp2.asp=
sFirstName = Request("txtFName")
response.write sFirstName
TIA,
Andrew
ASKER
Thanks for the reply, but this is an international registration form and names such as Pérez-Quintero need to be written to the SQL db and displayed in browsers as such.
Then why do you need to convet chars at all?
And what's with the
<!--<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
Why the <!-- ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sFirstName = CleanTheString(Request("tx
Then whenever you reference sFirstName (to response.write to the page or to use in a sql query), it will contain only the alphanumeric characters.
There are many ways to do that - I just included the method from here http://www.visualbasicscript.com/Remove-all-non-AlphaNumeric-characters-from-String-m26939.aspx:
Function CleanTheString(theString)
strAlphaNumeric = "0123456789abcdefghijklmno
For i = 1 to len(theString)
strChar = mid(theString,i,1)
If instr(strAlphaNumeric,strC
CleanedString = CleanedString & strChar
End If
Next
CleanTheString = CleanedString
End Function