CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 How can I escape single quotes in user input?

Print topic Send  topic

Author Message
Steven B
Posted: 07/07/2005, 5:14 PM

Hello.
Our codecharge-generated JSP application is throwing error whenever a user enters a name with a single quote, such as O'Brien. Is there a way to escape user input using CodeCharge's functionality?

Thanks,
Steven
peterr


Posts: 5971
Posted: 07/08/2005, 12:24 AM

Such escaping is automatic. But possibly this doesn't work properly with some databases (could be our bug), or you've used some custom code, or haven't set the field or parameter type properly, etc. You may want to contact the product support, as it could be considered a technical issue.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
agnes
Posted: 08/19/2005, 2:29 AM

when i enter O’brien where this word is copied from microsoft word and database is MSSQL7 .When ir etrive the data it is seens as O?brien

The single quotes gets converted into ?.Please help.

peterr


Posts: 5971
Posted: 08/19/2005, 2:48 AM

The (’) in O’brien above is not a single quote. It is a "smart quote" created by MS Word. It is not an ASCII character and MS SQL Server probably doesn't know how to save it or display it. Possibly you will need to convert it to the HTML equivalent, or type the text in notepad or standard text editor (instead of MS Word), or possibly using some encoding my help. Microsoft forums may be helpful as well.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
agnes
Posted: 08/19/2005, 5:20 AM

Quote agnes:
when i enter O’brien where this word is copied from microsoft word and database is MSSQL7 .When i retrive the data it is seens as O?brien

The single quotes gets converted into ?.Please help.
This problem does not exist for opera but only for IE and netscape :-/
peterr


Posts: 5971
Posted: 08/19/2005, 10:58 AM

Yes, it's possible. As you can see someone will need to fix this problem, either Web browsers, or you on the server or database side.
Please refer to the above answer.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
agnes
Posted: 08/22/2005, 5:35 AM

i have found a solution use the charcode function of javascript n replace
' ,' ,","
function chkSmartQuotes(formelement)
{
var a=(formelement.value);
var b=a.length;
var cha='8194';
var cha1='8193'
var cha2='8197';
var cha3='8198'
var ch=cha.length;
var i,j;
var a2="";
formelement.value="";
for(j=0;j<b;j++)
{
var a1=a.substring(j,j+1);
a2=a.charCodeAt(j)-23;
//alert(a2);
if(a2==cha || a2==cha1)
{
a2='\'';
formelement.value=formelement.value+a2;
}
else if(a2==cha2 || a2==cha3)
{
a2='\"';
formelement.value=formelement.value+a2;
}
else
{
formelement.value=formelement.value+a1;
}
}

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.