Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Special Characters  RSS feed

 
Tex Abrey
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way aroud sepcial characters when inserting into a database instead of going through the string and replacing them with something else and also without using escape characters for each one because the string i am using is the title of an article file and is different for every file so i don't know where the special characters will be.
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tex
Try using a prepared statement. Then you just insert the string into the SQL statement where you have defined your parameters. I know it works for things like single quotes and slashes.

Hope that helps
 
seetharama sarma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before sendind the data in to the database , you can escape the data with javascript escape function. while you are getting form the database just use unescape.
Ex:
<script language="javascript>
function onLoad()
{
doucment.frameName.title.value= unescape(<%= title %> ;
}
function go()
{
doucment.frameName.title.value = escape(doucment.frameName.title.value);
doucment.frameName.action="";
doucment.frameName.submit();
</script>
................
Use Go to send to next form...
use OnLoad while loading the page.
I think this will slove your problem.....
[ October 30, 2002: Message edited by: seetharam sarma ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!