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

escape quotes POSTed from HTML text field?  RSS feed

 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a user types an apostrophe or quote marks in a text input or textarea, do you have to intercept it at getParameter("mytextfield") or what? Do you have to go through that String character by character, or can you use the String methods to find them?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you've called getParameter, the results will be in a String that you can operate upon normally. I have a feeling I'm missing something in your question though...
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I took up your time--it was about 3 am and I wasn't thinking straight. I was thinking something delusional--that if a String contains a " character...well, that that couldn't happen. But now I realize that it gets escaped internally. Never mind...too much trying to remember to escape things for the database and for URLs and all that jazz. In OOP shouldn't our classes just *know* how to handle the input fed them? You know, situational/contextual smarts. But no ranting for now...

So, I was just playing with my DrJava interpreter window, and I found out that indexOf("\'") and indexOf("'") is the same...since this doesn't display too well, that's a single quote that we're looking for...I guess it was just to make things easier on the developer to allow you to ask that both ways...?



[ October 27, 2004: Message edited by: Stephen Huey ]
[ October 27, 2004: Message edited by: Stephen Huey ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!