JSP form input with double qoutes, Java cant see the qoutes
I am having an intermittent problem with double qoutes in a form input.
Sometimes the qoutes are recognized and they show up in the corresponding business code, sometimes they do not.
I have done this to test the issue:
I can print the input value in the JSP and the corresponding Action.
Test 1 - on screen displays "search stuff"
But Java sees search stuff (notice no qoutes)
Test 2 - on screen displays "search stuff"
But Java sees "search stuff"
If I copy the html into word, the qoutes appear differently. Indicating to me that they are of different ASCII or Encoding origin.
How could this have happened?
I cant seem to consistently make the qoutes unreadable by Java. It comes and goes.
What can I do about it?
My browser and my web server are both set to 8859-1 (Wester).
Message was edited by:
meconlin4192
Message was edited by:
meconlin4192
# 2
Okay, well there isnt really any problem code.
Sometimes the values have qoutes, sometimes they dont.
In both cases on the screen they appear the same.
Here is the code I am using to test the value of the first character:
log.writeDebug("(JSP) CHAR AT :" + lCritBean.mGeneralKeywords.charAt(0) +":" + (int)lCritBean.mGeneralKeywords.charAt(0)+":");
Sometimes it will show:
6/14/200719:00:22(JSP) CHAR AT :":34:
Sometimes it wil lshow:
6/14/200719:04:31(JSP) CHAR AT ::147:
In both cases the webpage shows the value as "single board computer".
When I view source using firefox of the html page, the qoutes appear visibily different from one another.
Message was edited by:
meconlin4192
# 4
What you term quotes aren't quotes at all. The character on your keyboard that comes when you press shift+ ' is not a quotation mark: "
Standard keyboards don't have quotation marks on them, and so many people make the mistake of thinking that the " character is a quotation mark. "This sentence is not enclosed in quotation marks." “This one is”
When you paste a sentence with a sentence surrounded with the marks "" into Word, Word will automatically change these to quotation marks “” since it assumes that's what you mean.
If you're interested, on a mac the left quotation is: option + [ and right: option + shift + [ (use ] for single quotations)
I haven't typed on a windows platform for a little while, but from what I remember the left is alt + 0147 and the right alt + 0148
The single quotation marks are near there too.
While we're on the subject...
That was not an ellipsis, but this is… (option + ;)
I'm not sure if that will come close to solving your problem, but I find it's a very very common misunderstanding, and might save you in the future.
# 5
I do have it narrowed down now.
I cant make those types of qoutes appear with my keyboard (the char 147).
No matter what I type, my qoutes are always (char 34 or whatever)
However, If I cut and past the problem strings directly from the customer service email that orginated the complaint, then I can get them.
So now the question is. How is this user generating strange qoutes, and why is no one else able to do so?